History

console.lua: sort completions

With the previous commit, this sorts completions with the same score alphabetically.

Guido Cella committed 1 year ago

Commit 5bbeabf1 parent 8ae3bee1 file · +2 −0Browse files

Unified · Split

player/lua/console.lua+2−0
@@ -1644,6 +1644,7 @@ complete = function () · 1643 unmodified lines
16441644 completion_buffer = {}
16451645 selected_completion_index = 0
16461646 completions = completions or {}
1647+ table.sort(completions)
16471648 completion_pos = completion_pos or 1
16481649 for i, match in ipairs(fuzzy_find(before_cur:sub(completion_pos),
16491650 completions, opts.case_sensitive)) do
@@ -1932,6 +1933,7 @@ mp.register_script_message('complete', function(list, start_pos) · 282 unmodified lines
19321933 completion_buffer = {}
19331934 selected_completion_index = 0
19341935 local completions = utils.parse_json(list)
1936+ table.sort(completions)
19351937 completion_pos = start_pos
19361938 completion_append = ''
19371939 for i, match in ipairs(fuzzy_find(line:sub(completion_pos, cursor),

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