vim-patch:9.2.0923: tabpage: closing a tab page loses the alternate tab page (#41229)

Problem:  Closing the current tab page resets the alternate tab page, even
          when that is another tab page which still exists, so that
          CTRL-Tab stops working (igorlfs).
Solution: Restore the last used tab page after entering another one to
          close the current one (Hirohito Higashi).

related: vim/vim#20965
closes:  vim/vim#20973

a05bd64c1d

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
zeertzjq
2026-08-08 09:30:03 +08:00
committed by GitHub
parent 318d6a7f59
commit 5d5b8e3e7d
2 changed files with 24 additions and 0 deletions

View File

@@ -945,6 +945,23 @@ func Test_lastused_tabpage()
tabonly!
endfunc
" Closing a tab page must keep the last used tab page when it is another one.
func Test_lastused_tabpage_close()
tabonly!
tabnew
tabnew
tabfirst
tablast
call assert_equal(1, tabpagenr('#'))
tabclose
call assert_equal(1, tabpagenr('#'))
call feedkeys("g\<Tab>", "xt")
call assert_equal(1, tabpagenr())
tabonly!
endfunc
" Test for tabpage allocation failure
func Test_tabpage_alloc_failure()
CheckFunction test_alloc_fail