[vim/vim] tabpage: closing a tab page loses the alternate tab page (PR #20973)
h_east (Vim Github Repository) <[email protected]> Fri, 07 Aug 2026 10:38:45 -0700
| Newsgroups | gmane.editors.vim.devel |
|---|---|
| Message-ID | <vim/vim/pull/[email protected]> |
```
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.
```
related: #20965
---
Closing the current tab page clears the alternate tab page even when the
alternate is a different tab page that still exists:
:tabnew
:tabnew
:tabfirst
:tablast
:echo tabpagenr('#') " 1
:tabclose
:echo tabpagenr('#') " 0, while tab page 1 is still there
`close_last_window_tabpage()` enters another tab page before closing the
current one, which makes the tab page about to be closed the last used one,
and `free_tabpage()` then resets it.
This does not fix the steps in #20965. There the alternate tab page becomes
the current one after the close, so there is nothing left to go back to
without keeping a history of visited tab pages. That would be out of line
with the rest of Vim, where the alternate file (`#`) and the previous window
(`CTRL-W p`) are single entries as well, and it would make the destination of
CTRL-Tab hard to predict.
You can view, comment on, or merge this pull request online at:
https://github.com/vim/vim/pull/20973
-- Commit Summary --
* tabpage: closing a tab page loses the alternate tab page
-- File Changes --
M src/testdir/test_tabpage.vim (17)
M src/window.c (6)
-- Patch Links --
https://github.com/vim/vim/pull/20973.patch
https://github.com/vim/vim/pull/20973.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/pull/20973
You are receiving this because you are subscribed to this thread.
Message ID: <vim/vim/pull/[email protected]>
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/pull/20973%40github.com.