mirror of
https://github.com/vim-airline/vim-airline.git
synced 2026-08-13 19:31:02 +08:00
util: use finish to skip the vim9 script part
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
Also drop the Vim9 script implementation of airline#util#exec_funcrefs(), because it will try to find script-local funcrefs, and thus errors out. fixes: #2753 Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
+28
-34
@@ -21,6 +21,31 @@ function! airline#util#has_vim9_script()
|
|||||||
\ get(g:, "airline_experimental", 0))
|
\ get(g:, "airline_experimental", 0))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
if v:version >= 704
|
||||||
|
function! airline#util#exec_funcrefs(list, ...)
|
||||||
|
for Fn in a:list
|
||||||
|
let code = call(Fn, a:000)
|
||||||
|
if code != 0
|
||||||
|
return code
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
function! airline#util#exec_funcrefs(list, ...)
|
||||||
|
" for 7.2; we cannot iterate the list, hence why we use range()
|
||||||
|
" for 7.3-[97, 328]; we cannot reuse the variable, hence the {}
|
||||||
|
for i in range(0, len(a:list) - 1)
|
||||||
|
let Fn{i} = a:list[i]
|
||||||
|
let code = call(Fn{i}, a:000)
|
||||||
|
if code != 0
|
||||||
|
return code
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
if !exists(":def") || !airline#util#has_vim9_script()
|
if !exists(":def") || !airline#util#has_vim9_script()
|
||||||
" TODO: Try to cache winwidth(0) function
|
" TODO: Try to cache winwidth(0) function
|
||||||
" e.g. store winwidth per window and access that, only update it, if the size
|
" e.g. store winwidth per window and access that, only update it, if the size
|
||||||
@@ -100,30 +125,6 @@ if !exists(":def") || !airline#util#has_vim9_script()
|
|||||||
endfunction
|
endfunction
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if v:version >= 704
|
|
||||||
function! airline#util#exec_funcrefs(list, ...)
|
|
||||||
for Fn in a:list
|
|
||||||
let code = call(Fn, a:000)
|
|
||||||
if code != 0
|
|
||||||
return code
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
return 0
|
|
||||||
endfunction
|
|
||||||
else
|
|
||||||
function! airline#util#exec_funcrefs(list, ...)
|
|
||||||
" for 7.2; we cannot iterate the list, hence why we use range()
|
|
||||||
" for 7.3-[97, 328]; we cannot reuse the variable, hence the {}
|
|
||||||
for i in range(0, len(a:list) - 1)
|
|
||||||
let Fn{i} = a:list[i]
|
|
||||||
let code = call(Fn{i}, a:000)
|
|
||||||
if code != 0
|
|
||||||
return code
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
return 0
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Compatibility wrapper for strchars, in case this vim version does not
|
" Compatibility wrapper for strchars, in case this vim version does not
|
||||||
" have it natively
|
" have it natively
|
||||||
@@ -257,6 +258,9 @@ if !exists(":def") || !airline#util#has_vim9_script()
|
|||||||
\ get(g:, "airline_multiline", 0))
|
\ get(g:, "airline_multiline", 0))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" End legacy Vim Script
|
||||||
|
finish
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
def airline#util#winwidth(...args: list<any>): number
|
def airline#util#winwidth(...args: list<any>): number
|
||||||
@@ -320,16 +324,6 @@ else
|
|||||||
return getwinvar(winnr, key, def)
|
return getwinvar(winnr, key, def)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def airline#util#exec_funcrefs(list: list<any>, ...args: list<any>): number
|
|
||||||
for Fn in list
|
|
||||||
var code = call(Fn, args)
|
|
||||||
if code != 0
|
|
||||||
return code
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
return 0
|
|
||||||
enddef
|
|
||||||
|
|
||||||
def airline#util#strchars(str: string): number
|
def airline#util#strchars(str: string): number
|
||||||
if s:has_strchars
|
if s:has_strchars
|
||||||
return strchars(str)
|
return strchars(str)
|
||||||
|
|||||||
Reference in New Issue
Block a user