]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0756: Session with multiple tabpages sets 'winminheight' to 0 v9.2.0756
authorzeertzjq <zeertzjq@outlook.com>
Tue, 30 Jun 2026 18:34:12 +0000 (18:34 +0000)
committerChristian Brabandt <cb@256bit.org>
Tue, 30 Jun 2026 18:34:12 +0000 (18:34 +0000)
Problem:  Session with multiple tabpages sets 'winminheight' to 0.
Solution: Only save 'winminheight' and 'winminwidth' once (zeertzjq).

related: #8119
related: neovim/neovim#40493
closes: #20673

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/session.c
src/testdir/test_mksession.vim
src/version.c

index 0fa03e556ded9bb0f31d8d121c574185b69ed5eb..7c183219260ca0415eaa06472d34779db8df66ce 100644 (file)
@@ -889,9 +889,11 @@ makeopens(
            // cursor can be set.  This is done again below.
            // winminheight and winminwidth need to be set to avoid an error if
            // the user has set winheight or winwidth.
-           if (put_line(fd, "save_winminheight = &winminheight") == FAIL
-                   || put_line(fd, "save_winminwidth = &winminwidth")
-                                                                      == FAIL)
+           if (!restore_height_width
+                   && (put_line(fd, "save_winminheight = &winminheight")
+                                                                       == FAIL
+                       || put_line(fd, "save_winminwidth = &winminwidth")
+                                                                      == FAIL))
                goto fail;
            if (put_line(fd, "set winminheight=0") == FAIL
                    || put_line(fd, "set winheight=1") == FAIL
index b63f0edfc831b4a09b980a0dfe37b4abbfdd7001..958c1180158ade53652f8891a0f92217d9be5a54 100644 (file)
@@ -1074,9 +1074,19 @@ func Test_mksession_winminheight()
     endif
   endfor
   call assert_equal(2, found_restore)
+  " Test with multiple tabpages
+  tab split | split | tab split | split
+  call assert_equal(3, tabpagenr('$'))
+  mksession! Xtest_mks.out
+  tabclose | tabclose | close
+  call assert_equal(1, tabpagenr('$'))
+  set winminheight=2 winminwidth=2
+  source Xtest_mks.out
+  call assert_equal(3, tabpagenr('$'))
+  call assert_equal([2, 2], [&winminheight, &winminwidth])
+  tabclose | tabclose | close
   call delete('Xtest_mks.out')
-  close
-  set sessionoptions&
+  set sessionoptions& winminheight& winminwidth&
 endfunc
 
 " Test for mksession with and without options restores shortmess
index 3ce9aee7ede6d33ff183f9ceef81a3a5180eebe9..6aa1d99a67b18890777565e93ebcadda9951ece1 100644 (file)
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    756,
 /**/
     755,
 /**/