History

console.lua: limit the length of selectable items

Giving very long lines to libass freezes mpv and makes the CPU spin (though it's fine with terminal output). This is often the case user-data/mpv/ytdl/json-subprocess-result in the property list. So limit the length of selectable items to 300 characters (not Unicode aware). This is enough to fill a 1920x1080 window with font_size=16 and Japanese text.

Guido Cella committed 1 year ago

Commit cf3bc0a1 parent 5ec569d1 file · +1 −1Browse files

Unified · Split

player/lua/console.lua+1−1
@@ -1814,7 +1814,7 @@ mp.register_script_message('get-input', function (script_name, args) · 1813 unmodified lines
18141814 if args.items then
18151815 selectable_items = {}
18161816 for i, item in ipairs(args.items) do
1817− selectable_items[i] = item:gsub("[\r\n].*", "⋯")
1817+ selectable_items[i] = item:gsub("[\r\n].*", "⋯"):sub(1, 300)
18181818 end
18191819
18201820 matches = {}

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