console.lua: only clip items between UTF-8 characters
Since with the new horizontal scrolling the end of lines can be visible, ensure not to clip lines in the middle of UTF-8 characters to not show mojibake, also adding … to show when items are clipped. Also replace the existing use of ⋯ with …
This commit is contained in:
1 parent
a385c0635b
commit
85bf9f4ff4
1 file changed
+3
-1
@@ -1693,7 +1693,9 @@ mp.register_script_message("get-input", function (script_name, args)
|
||||
end
|
||||
|
||||
for i, item in ipairs(args.items) do
|
||||
selectable_items[i] = item:gsub("[\r\n].*", "⋯"):sub(1, limit)
|
||||
local last = next_utf8(item, limit) - 1
|
||||
selectable_items[i] = item:gsub("[\r\n].*", "…"):sub(1, last) ..
|
||||
(last < #item and "…" or "")
|
||||
end
|
||||
|
||||
calculate_max_item_width()
|
||||
|
||||
Reference in new issue
Block a user