1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-17 04:58:06 +00:00

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.
This commit is contained in:
Guido Cella 2024-11-22 16:55:01 +01:00 committed by Kacper Michajłow
parent 5ec569d073
commit cf3bc0a722

View File

@ -1814,7 +1814,7 @@ mp.register_script_message('get-input', function (script_name, args)
if args.items then
selectable_items = {}
for i, item in ipairs(args.items) do
selectable_items[i] = item:gsub("[\r\n].*", "")
selectable_items[i] = item:gsub("[\r\n].*", ""):sub(1, 300)
end
matches = {}