]> granicus.if.org Git - vim/commitdiff
patch 8.2.2560: setting 'winminheigt' does not take tabline into account v8.2.2560
authorBram Moolenaar <Bram@vim.org>
Mon, 1 Mar 2021 20:02:46 +0000 (21:02 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 1 Mar 2021 20:02:46 +0000 (21:02 +0100)
Problem:    Setting 'winminheigt' does not take tabline into account.
Solution:   Subtract the tabline from the available height. (closes #7899)

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

index 23e0de4377350ab437df2aa92d0bf9f019b7b044..2595392a033fdc1f9c8942eaaedf68a0e6c6e39e 100644 (file)
@@ -1015,6 +1015,26 @@ func Test_opt_winminheight()
   set winheight&
 endfunc
 
+func Test_opt_winminheight_term()
+  CheckRunVimInTerminal
+
+  " The tabline should be taken into account.
+  let lines =<< trim END
+    set wmh=0 stal=2
+    below sp | wincmd _
+    below sp | wincmd _
+    below sp | wincmd _
+    below sp
+  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 67fc08c683cdd50d498add997f95e05de3b95e32..7f1e81872a0ba7e836703fb8a8431917de8084ba 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2560,
 /**/
     2559,
 /**/
index 58a216daf7886db01802cd2319a1cdcc851cd6ad..a810a6af229298ac2a373deb2134df7459418978 100644 (file)
@@ -5860,7 +5860,7 @@ win_setminheight(void)
     // loop until there is a 'winminheight' that is possible
     while (p_wmh > 0)
     {
-       room = Rows - p_ch;
+       room = Rows - p_ch - tabline_height();
        needed = frame_minheight(topframe, NULL);
        if (room >= needed)
            break;