Avoid tabpagenr('#') on Vim versions without it

References: https://github.com/tpope/vim-fugitive/pull/2262
This commit is contained in:
Tim Pope
2024-02-11 12:31:10 -05:00
parent e3cdf27e19
commit 8376227c9d

View File

@@ -4368,13 +4368,15 @@ function! fugitive#DidChange(...) abort
if a:0 > 1 ? a:2 : (!a:0 || a:1 isnot# 0) if a:0 > 1 ? a:2 : (!a:0 || a:1 isnot# 0)
let t = reltime() let t = reltime()
let t:fugitive_reload_status = t let t:fugitive_reload_status = t
let prevnr = tabpagenr('#') let prevnr = has('patch-8.2.1401') ? tabpagenr('#') : 0
for tabnr in range(1, tabpagenr('$')) for tabnr in range(1, tabpagenr('$'))
if tabnr != prevnr if tabnr != prevnr
call settabvar(tabnr, 'fugitive_reload_status', t) call settabvar(tabnr, 'fugitive_reload_status', t)
endif endif
endfor endfor
if prevnr
call settabvar(prevnr, 'fugitive_reload_status', t) call settabvar(prevnr, 'fugitive_reload_status', t)
endif
call s:ReloadTabStatus() call s:ReloadTabStatus()
else else
call s:ReloadWinStatus() call s:ReloadWinStatus()