vim-patch:9.1.0572: cannot specify tab page closing behaviour (#29682)

Problem:  cannot specify tab page closing behaviour
          (Gianluca Pacchiella)
Solution: Add the 'tabclose' option (LemonBoy).

fixes: vim/vim#5967
closes: vim/vim#15204

5247b0b92e

Co-authored-by: LemonBoy <thatlemon@gmail.com>
This commit is contained in:
zeertzjq
2024-07-13 08:56:58 +08:00
committed by GitHub
parent 10256bb760
commit b1aa8f5eb8
12 changed files with 161 additions and 11 deletions

View File

@@ -3456,14 +3456,22 @@ static frame_T *win_altframe(win_T *win, tabpage_T *tp)
// Return the tabpage that will be used if the current one is closed.
static tabpage_T *alt_tabpage(void)
{
// Use the next tab page if possible.
if (curtab->tp_next != NULL) {
return curtab->tp_next;
// Use the last accessed tab page, if possible.
if ((tcl_flags & TCL_USELAST) && valid_tabpage(lastused_tabpage)) {
return lastused_tabpage;
}
// Find the last but one tab page.
// Use the previous tab page, if possible.
bool forward = curtab->tp_next != NULL
&& ((tcl_flags & TCL_LEFT) == 0 || curtab == first_tabpage);
tabpage_T *tp;
for (tp = first_tabpage; tp->tp_next != curtab; tp = tp->tp_next) {}
if (forward) {
tp = curtab->tp_next;
} else {
for (tp = first_tabpage; tp->tp_next != curtab; tp = tp->tp_next) {}
}
return tp;
}