tabline: use strpart() with chars if possible (fixes #2297)

This commit is contained in:
Christian Brabandt 2020-11-26 10:04:34 +01:00
parent a168ca7a28
commit cbf0a8e69a
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
1 changed files with 5 additions and 1 deletions

View File

@ -23,7 +23,11 @@ function! airline#extensions#tabline#formatters#default#format(bufnr, buffers)
let _ .= fnamemodify(name, fmod)
endif
if a:bufnr != bufnr('%') && fnametruncate && strlen(_) > fnametruncate
let _ = strpart(_, 0, fnametruncate)
if v:version > 802 || (v:version == 802 && has("patch1517"))
let _ = strpart(_, 0, fnametruncate, 1)
else
let _ = strpart(_, 0, fnametruncate)
endif
endif
endif