console.lua: don't reinsert the next characters on complete

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.
This commit is contained in:
Guido Cella authored and Kacper Michajłow committed 2024-12-02 20:57:01 +01:00
1 parent 9d67fc28e2
commit 063410fa04
1 file changed
+2 -1
+2 -1
View File
@@ -1431,7 +1431,8 @@ cycle_through_suggestions = function (backwards)
local before_cur = line:sub(1, completion_pos - 1) ..
suggestion_buffer[selected_suggestion_index] .. completion_append
line = before_cur .. strip_common_characters(line:sub(cursor), completion_append)
line = before_cur .. strip_common_characters(line:sub(cursor),
suggestion_buffer[selected_suggestion_index] .. completion_append)
cursor = before_cur:len() + 1
update()
end