fix(eval): 0 should mean current tabpage in gettabvar() (#36891)

This matches the gettabvar() behavior change in Vim 8.1.1218.

(cherry picked from commit df9e4a037a)
This commit is contained in:
zeertzjq
2025-12-10 08:53:57 +08:00
committed by github-actions[bot]
parent 9acbf5102f
commit 7e99466a89
2 changed files with 9 additions and 0 deletions

View File

@@ -4374,6 +4374,10 @@ tabpage_T *find_tabpage(int n)
tabpage_T *tp;
int i = 1;
if (n == 0) {
return curtab;
}
for (tp = first_tabpage; tp != NULL && i != n; tp = tp->tp_next) {
i++;
}

View File

@@ -137,6 +137,11 @@ describe('tabpage', function()
eq(1, fn.nvim_tabpage_get_number(0))
end)
it('0 means current tabpage for gettabvar()', function()
command('let t:tabvar = 42')
eq(42, fn.gettabvar(0, 'tabvar'))
end)
it(':tabs does not overflow IObuff with long path with comma #20850', function()
api.nvim_buf_set_name(0, ('x'):rep(1024) .. ',' .. ('x'):rep(1024))
command('tabs')