fix(session): window sizes lost in tabpages after an excluded window #41478

Problem: `restore_size` is scoped to all of `makeopens()`, so a window
excluded by 'sessionoptions' latches it off for every tabpage written
afterwards: with `sessionoptions-=terminal`, a terminal in tab 2 makes
tab 3 restore with `wincmd =` instead of its stored sizes.

Solution: Recompute it per tabpage.
This commit is contained in:
Barrett Ruth
2026-08-28 05:48:34 +10:00
committed by GitHub
parent 66868ca408
commit 617f9e628c

View File

@@ -587,7 +587,6 @@ static int store_session_globals(FILE *fd)
static int makeopens(FILE *fd, char *dirnow)
{
bool only_save_windows = true;
bool restore_size = true;
win_T *edited_win = NULL;
win_T *tab_firstwin;
frame_T *tab_topframe;
@@ -823,6 +822,7 @@ static int makeopens(FILE *fd, char *dirnow)
// Check if window sizes can be restored (no windows omitted).
// Remember the window number of the current window after restoring.
int nr = 0;
bool restore_size = true;
for (win_T *wp = tab_firstwin; wp != NULL; wp = wp->w_next) {
if (ses_do_win(wp)) {
nr++;