console.lua: strip multiple lines in selectable items

If an item contains newlines, it hides the top items. This is often the
case for sub-ass-extradata and metadata/ytdl_description in the property
list. So keep only the first line.
This commit is contained in:
Guido Cella
2024-11-22 16:44:00 +01:00
committed by Kacper Michajłow
parent 33e297bd8f
commit 5ec569d073

View File

@@ -1811,8 +1811,12 @@ mp.register_script_message('get-input', function (script_name, args)
history = histories[id]
history_pos = #history + 1
selectable_items = args.items
if selectable_items then
if args.items then
selectable_items = {}
for i, item in ipairs(args.items) do
selectable_items[i] = item:gsub("[\r\n].*", "")
end
matches = {}
selected_match = args.default_item or 1
default_item = args.default_item