History

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.

Guido Cella committed 1 year ago

Commit 063410f1 parent 9d67fc21 file · +2 −1Browse files

Unified · Split

player/lua/console.lua+2−1
@@ -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_append1433 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() + 11436 cursor = before_cur:len() + 1
1436 update()1437 update()
1437end1438end

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t