From 51e74f1d1f35025f2774bd0e4650854b50f14cb3 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Tue, 20 Aug 2019 22:22:06 +0200 Subject: [PATCH] util: micro-optimization of existence check for strcharpart() --- autoload/airline/util.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/airline/util.vim b/autoload/airline/util.vim index 962a72c2..6ae749a2 100644 --- a/autoload/airline/util.vim +++ b/autoload/airline/util.vim @@ -10,6 +10,7 @@ call airline#init#bootstrap() let s:spc = g:airline_symbols.space let s:nomodeline = (v:version > 703 || (v:version == 703 && has("patch438"))) ? '' : '' let s:has_strchars = exists('*strchars') +let s:has_strcharpart = exists('*strcharpart') " TODO: Try to cache winwidth(0) function " e.g. store winwidth per window and access that, only update it, if the size @@ -112,7 +113,7 @@ function! airline#util#strchars(str) endfunction function! airline#util#strcharpart(...) - if exists('*strcharpart') + if s:has_strcharpart return call('strcharpart', a:000) else " does not handle multibyte chars :(