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
1644 completion_buffer = {}1644 completion_buffer = {}
1645 selected_completion_index = 01645 selected_completion_index = 0
1646 completions = completions or {}1646 completions = completions or {}
1647 table.sort(completions)
1647 completion_pos = completion_pos or 11648 completion_pos = completion_pos or 1
1648 for i, match in ipairs(fuzzy_find(before_cur:sub(completion_pos),1649 for i, match in ipairs(fuzzy_find(before_cur:sub(completion_pos),
1649 completions, opts.case_sensitive)) do1650 completions, opts.case_sensitive)) do
@@ -1932,6 +1933,7 @@ mp.register_script_message('complete', function(list, start_pos) · 282 unmodified lines
1932 completion_buffer = {}1933 completion_buffer = {}
1933 selected_completion_index = 01934 selected_completion_index = 0
1934 local completions = utils.parse_json(list)1935 local completions = utils.parse_json(list)
1936 table.sort(completions)
1935 completion_pos = start_pos1937 completion_pos = start_pos
1936 completion_append = ''1938 completion_append = ''
1937 for i, match in ipairs(fuzzy_find(line:sub(completion_pos, cursor),1939 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