changeset 24037:b5a6de6a8915 v8.2.2560

patch 8.2.2560: setting 'winminheigt' does not take tabline into account Commit: https://github.com/vim/vim/commit/39d4cab494248131b6fb07aba633aa4da7871a57 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Mar 1 21:02:46 2021 +0100 patch 8.2.2560: setting 'winminheigt' does not take tabline into account Problem: Setting 'winminheigt' does not take tabline into account. Solution: Subtract the tabline from the available height. (closes https://github.com/vim/vim/issues/7899)
author Bram Moolenaar <Bram@vim.org>
date Mon, 01 Mar 2021 21:15:03 +0100
parents cb3227f4d7a8
children 52c3c86b10f1
files src/testdir/test_options.vim src/version.c src/window.c
diffstat 3 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_options.vim
+++ b/src/testdir/test_options.vim
@@ -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!
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2560,
+/**/
     2559,
 /**/
     2558,
--- a/src/window.c
+++ b/src/window.c
@@ -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;