From 24115a0d84f4935cd8a7826db2584c609e0f0c9a Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Sun, 12 Jul 2020 15:03:58 +0200 Subject: [PATCH] Fix string len for cyrillic chars --- init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 823a28e..6e6bc3e 100644 --- a/init.lua +++ b/init.lua @@ -1089,7 +1089,8 @@ local function get_rcp_lbl(lang_code, show_usages, unum, rnum, fs, panel, spacin end lbl = get_translation(lang_code, lbl) - local shift = min(0.9, abs(13 - max(13, #lbl)) * 0.1) + local lbl_len = #(lbl):gsub("[\128-\191]", "") -- Count chars, not bytes in UTF-8 strings + local shift = min(0.9, abs(13 - max(13, lbl_len)) * 0.1) fs[#fs + 1] = fmt(FMT.label, XOFFSET + (sfinv_only and 2.3 or 1.6) - shift,