History

console.lua: restore the order of items after clearing the input line

When you type something in select mode and then delete it, table.sort changes how selectable items are sorted. Restore the order specified by the mp.input caller in this case.

Guido Cella committed 2 years ago

Commit e07470a1 parent 97af5c91 file · +8 −2Browse files

Unified · Split

player/lua/console.lua+8−2
@@ -638,8 +638,14 @@ local function handle_edit() · 637 unmodified lines
638 matches = {}638 matches = {}
639 selected_match = 1639 selected_match = 1
640 640
641 for i, match in ipairs(fuzzy_find(line, selectable_items)) do641 if line == '' then
642 matches[i] = { index = match, text = selectable_items[match] }642 for i, item in ipairs(selectable_items) do
643 matches[i] = { index = i, text = item }
644 end
645 else
646 for i, match in ipairs(fuzzy_find(line, selectable_items)) do
647 matches[i] = { index = match, text = selectable_items[match] }
648 end
643 end649 end
644 end650 end
645 651

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