diff options
| author | elianiva <dicha.arkana03@gmail.com> | 2021-02-26 20:17:47 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-26 20:17:47 +0700 |
| commit | d37dc88eab1be7dc853af212537fdeb9fe2542a7 (patch) | |
| tree | 42954b7ee4346214ad50a366e9447b48d4dce0fd /lua/telescope/utils.lua | |
| parent | e2696d694a6e6fb9f2abfdb238a477b654e0aa77 (diff) | |
fix: proper multibytes chars alignment (#560)
I am 100% did not spoil anything, I swear
Diffstat (limited to 'lua/telescope/utils.lua')
| -rw-r--r-- | lua/telescope/utils.lua | 7 |
1 files changed, 7 insertions, 0 deletions
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 |
