fix: proper multibytes chars alignment (#560)

I am 100% did not spoil anything, I swear
This commit is contained in:
elianiva
2021-02-26 20:17:47 +07:00
committed by GitHub
parent e2696d694a
commit d37dc88eab
2 changed files with 10 additions and 4 deletions

View File

@@ -284,4 +284,11 @@ function utils.strcharpart(str, nchar, charlen)
return str:sub(nbyte + 1, nbyte + len)
end
utils.align_str = function(string, width, right_justify)
local str_len = utils.strdisplaywidth(string)
return right_justify
and string.rep(" ", width - str_len)..string
or string..string.rep(" ", width - str_len)
end
return utils