changeset 24108:0a5eba7e6660 v8.2.2595

patch 8.2.2595: setting 'winminheight' may cause 'lines' to change Commit: https://github.com/vim/vim/commit/9e813b3dea94a8952b732a224fa31beba6e85973 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 13 14:29:05 2021 +0100 patch 8.2.2595: setting 'winminheight' may cause 'lines' to change Problem: Setting 'winminheight' may cause 'lines' to change. Solution: Also take minimal height of other tabpages into account. (https://github.com/vim/vim/issues/7899)
author Bram Moolenaar <Bram@vim.org>
date Sat, 13 Mar 2021 14:30:03 +0100
parents 53bdd47b1ef6
children f26a7a00f121
files src/testdir/test_options.vim src/version.c src/window.c
diffstat 3 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_options.vim
+++ b/src/testdir/test_options.vim
@@ -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!
--- 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 */
 /**/
+    2595,
+/**/
     2594,
 /**/
     2593,
--- a/src/window.c
+++ b/src/window.c
@@ -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;