Skip to content

Commit 7aee40e

Browse files
committed
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 …
1 parent 3f59ac9 commit 7aee40e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

player/lua/console.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,8 @@ mp.register_script_message("get-input", function (script_name, args)
16731673
local limit = terminal_output() and 5000 or (5 * osd_width / opts.font_size)
16741674

16751675
for i, item in ipairs(args.items) do
1676-
selectable_items[i] = item:gsub("[\r\n].*", ""):sub(1, limit)
1676+
local last = next_utf8(item, limit) - 1
1677+
selectable_items[i] = item:gsub("[\r\n].*", ""):sub(1, last) .. (last < #item and "" or "")
16771678
end
16781679

16791680
calculate_max_item_width()

0 commit comments

Comments
 (0)