Fix string len for cyrillic chars

This commit is contained in:
Jean-Patrick Guerrero 2020-07-12 15:03:58 +02:00
parent 13b4edcc46
commit 24115a0d84

@ -1089,7 +1089,8 @@ local function get_rcp_lbl(lang_code, show_usages, unum, rnum, fs, panel, spacin
end end
lbl = get_translation(lang_code, lbl) 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, fs[#fs + 1] = fmt(FMT.label,
XOFFSET + (sfinv_only and 2.3 or 1.6) - shift, XOFFSET + (sfinv_only and 2.3 or 1.6) - shift,