From 85bf9f4ff46cd45686cfe2fd22f49828877db5cb Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Fri, 24 Oct 2025 10:39:06 +0200 Subject: [PATCH] console.lua: only clip items between UTF-8 characters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 … --- player/lua/console.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/player/lua/console.lua b/player/lua/console.lua index 85e5eab0c5..27ab10c974 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -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()