From 356afc0e6e69f3c5c0e4a39b57598efcd36eb974 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Tue, 23 Jan 2024 12:22:40 +0300 Subject: [PATCH] Be friendly to wide characters --- .../stargrave/start/buftabline/autoload/buftabline.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vim/.vim/pack/stargrave/start/buftabline/autoload/buftabline.vim b/vim/.vim/pack/stargrave/start/buftabline/autoload/buftabline.vim index d4c6efc..d5c2721 100644 --- a/vim/.vim/pack/stargrave/start/buftabline/autoload/buftabline.vim +++ b/vim/.vim/pack/stargrave/start/buftabline/autoload/buftabline.vim @@ -13,9 +13,10 @@ export def Do(): string for buf in split(bufsRaw, "\n")[ : 16] leftIdx = stridx(buf, '"') rightIdx = strridx(buf, '"') - filename = substitute(buf[leftIdx + 1 : rightIdx - 1], "%", "%%", "g") - linenum = split(buf[rightIdx : ], " ")[-1] - attrs = split(buf[ : leftIdx - 1], '\s\+') + filename = substitute( + strpart(buf, leftIdx + 1, rightIdx - leftIdx - 1), "%", "%%", "g") + linenum = split(strpart(buf, rightIdx), " ")[-1] + attrs = split(strpart(buf, 0, leftIdx - 1), '\s\+') attrs = map(attrs, 'substitute(v:val, "%", "%%", "g")') attr = (len(attrs) == 1) ? attrs[0] : attrs[0] .. ":" .. join(attrs[1 :], "") attr = "%#TabLine#" .. attr .. "%*" -- 2.44.0