From d37dc88eab1be7dc853af212537fdeb9fe2542a7 Mon Sep 17 00:00:00 2001 From: elianiva Date: Fri, 26 Feb 2021 20:17:47 +0700 Subject: fix: proper multibytes chars alignment (#560) I am 100% did not spoil anything, I swear --- lua/telescope/utils.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lua/telescope/utils.lua') diff --git a/lua/telescope/utils.lua b/lua/telescope/utils.lua index 4606e19..ecd7fd4 100644 --- a/lua/telescope/utils.lua +++ b/lua/telescope/utils.lua @@ -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 -- cgit v1.2.3