]> granicus.if.org Git - vim/commitdiff
patch 8.2.2595: setting 'winminheight' may cause 'lines' to change v8.2.2595
authorBram Moolenaar <Bram@vim.org>
Sat, 13 Mar 2021 13:29:05 +0000 (14:29 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 13 Mar 2021 13:29:05 +0000 (14:29 +0100)
Problem:    Setting 'winminheight' may cause 'lines' to change.
Solution:   Also take minimal height of other tabpages into account. (#7899)

src/testdir/test_options.vim
src/version.c
src/window.c

index 2595392a033fdc1f9c8942eaaedf68a0e6c6e39e..54042d42f70ad44190e1d86b8c10e469a0d01d10 100644 (file)
@@ -1035,6 +1035,27 @@ func Test_opt_winminheight_term()
   call delete('Xwinminheight')
 endfunc
 
+func Test_opt_winminheight_term_tabs()
+  CheckRunVimInTerminal
+
+  " The tabline should be taken into account.
+  let lines =<< trim END
+    set wmh=0 stal=2
+    split
+    split
+    split
+    split
+    tabnew
+  END
+  call writefile(lines, 'Xwinminheight')
+  let buf = RunVimInTerminal('-S Xwinminheight', #{rows: 11})
+  call term_sendkeys(buf, ":set wmh=1\n")
+  call WaitForAssert({-> assert_match('E36: Not enough room', term_getline(buf, 11))})
+
+  call StopVimInTerminal(buf)
+  call delete('Xwinminheight')
+endfunc
+
 " Test for the 'winminwidth' option
 func Test_opt_winminwidth()
   only!
index f1b823226e07b68a2ba0292b11b0506d15fc4e27..3981323f85068fcea88c54ec9b8d29343f42f99f 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2595,
 /**/
     2594,
 /**/
index a810a6af229298ac2a373deb2134df7459418978..3e32b3759ea270b94adf621e5ab5d6b1a4b509a9 100644 (file)
@@ -5860,8 +5860,8 @@ win_setminheight(void)
     // loop until there is a 'winminheight' that is possible
     while (p_wmh > 0)
     {
-       room = Rows - p_ch - tabline_height();
-       needed = frame_minheight(topframe, NULL);
+       room = Rows - p_ch;
+       needed = min_rows() - 1;  // 1 was added for the cmdline
        if (room >= needed)
            break;
        --p_wmh;