This avoids inserting the characters in front of the cursor again when completing to text already in front of the cursor. This is important after 2f271a92de made Enter automatically insert the first completion.
Unified · Split
| @@ -1431,7 +1431,8 @@ cycle_through_suggestions = function (backwards) · 1430 unmodified lines | |||
| 1431 | 1431 | ||
| 1432 | local before_cur = line:sub(1, completion_pos - 1) .. | 1432 | local before_cur = line:sub(1, completion_pos - 1) .. |
| 1433 | suggestion_buffer[selected_suggestion_index] .. completion_append | 1433 | suggestion_buffer[selected_suggestion_index] .. completion_append |
| 1434 | line = before_cur .. strip_common_characters(line:sub(cursor), completion_append) | 1434 | line = before_cur .. strip_common_characters(line:sub(cursor), |
| 1435 | suggestion_buffer[selected_suggestion_index] .. completion_append) | ||
| 1435 | cursor = before_cur:len() + 1 | 1436 | cursor = before_cur:len() + 1 |
| 1436 | update() | 1437 | update() |
| 1437 | end | 1438 | end |