mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-28 23:13:18 +08:00
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:
committed by
Kacper Michajłow
parent
a385c0635b
commit
85bf9f4ff4
@@ -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