From 8376227c9d5f9cfdc85a9b228997a1644176eb37 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 11 Feb 2024 12:31:10 -0500 Subject: [PATCH] Avoid tabpagenr('#') on Vim versions without it References: https://github.com/tpope/vim-fugitive/pull/2262 --- autoload/fugitive.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 6f924b3..cb6ae9e 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -4368,13 +4368,15 @@ function! fugitive#DidChange(...) abort if a:0 > 1 ? a:2 : (!a:0 || a:1 isnot# 0) let t = reltime() let t:fugitive_reload_status = t - let prevnr = tabpagenr('#') + let prevnr = has('patch-8.2.1401') ? tabpagenr('#') : 0 for tabnr in range(1, tabpagenr('$')) if tabnr != prevnr call settabvar(tabnr, 'fugitive_reload_status', t) endif endfor - call settabvar(prevnr, 'fugitive_reload_status', t) + if prevnr + call settabvar(prevnr, 'fugitive_reload_status', t) + endif call s:ReloadTabStatus() else call s:ReloadWinStatus()