]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.0191: messages test fails; window size incorrect v9.0.0191
authorBram Moolenaar <Bram@vim.org>
Thu, 11 Aug 2022 13:13:37 +0000 (14:13 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 11 Aug 2022 13:13:37 +0000 (14:13 +0100)
Problem:    Messages test fails; window size incorrect when 'cmdheight' is
            made smaller.
Solution:   Properly cleanup after test with cmdheight zero.  Resize windows
            correctly when 'cmdheight' gets smaller.

src/testdir/dumps/Test_changing_cmdheight_5.dump [new file with mode: 0644]
src/testdir/test_cmdline.vim
src/testdir/test_messages.vim
src/version.c
src/window.c

diff --git a/src/testdir/dumps/Test_changing_cmdheight_5.dump b/src/testdir/dumps/Test_changing_cmdheight_5.dump
new file mode 100644 (file)
index 0000000..fb2a521
--- /dev/null
@@ -0,0 +1,8 @@
+> +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|[+3#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+| +0&&@74
index 92adbd10b6b617a8002ff52a534d59e8f8c6795a..521312a8b1febd37608529e6e54bfa69adaf7485 100644 (file)
@@ -239,6 +239,11 @@ func Test_changing_cmdheight()
   call term_sendkeys(buf, ":set cmdheight-=2\<CR>")
   call VerifyScreenDump(buf, 'Test_changing_cmdheight_4', {})
 
+  " reducing window size and then setting cmdheight 
+  call term_sendkeys(buf, ":resize -1\<CR>")
+  call term_sendkeys(buf, ":set cmdheight=1\<CR>")
+  call VerifyScreenDump(buf, 'Test_changing_cmdheight_5', {})
+
   " clean up
   call StopVimInTerminal(buf)
   call delete('XTest_cmdheight')
index 1f1bb9b2681d0d1dd2337ca6e5dc40741094d45c..3c3712ea0c05f0d09e33f7ae5fa931e576afc491 100644 (file)
@@ -388,6 +388,7 @@ func Test_fileinfo_after_echo()
 endfunc
 
 func Test_cmdheight_zero()
+  enew
   set cmdheight=0
   set showcmd
   redraw!
@@ -437,10 +438,13 @@ func Test_cmdheight_zero()
   7
   call feedkeys(":\"\<C-R>=line('w0')\<CR>\<CR>", "xt")
   call assert_equal('"1', @:)
-  bwipe!
 
+  bwipe!
+  bwipe!
   set cmdheight&
   set showcmd&
+  tabnew
+  tabonly
 endfunc
 
 " vim: shiftwidth=2 sts=2 expandtab
index a9887fa62034ad00ceb8840f19e8652ea8cc7a56..c89996625677d9078084c715c687ef8b32f6ed3d 100644 (file)
@@ -735,6 +735,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    191,
 /**/
     190,
 /**/
index 5b192cc893fdf6658881754ae3b8c1d83dc2e5a0..7d2fe42a4074f4f2e88b0c4299e62992109d5da5 100644 (file)
@@ -6555,6 +6555,12 @@ command_height(void)
     if (p_ch > old_p_ch && cmdline_row <= Rows - p_ch)
        return;
 
+    // If cmdline_row is smaller than what it is supposed to be for 'cmdheight'
+    // then set old_p_ch to what it would be, so that the windows get resized
+    // properly for the new value.
+    if (cmdline_row < Rows - p_ch)
+       old_p_ch = Rows - cmdline_row;
+
     // Find bottom frame with width of screen.
     frp = lastwin->w_frame;
     while (frp->fr_width != Columns && frp->fr_parent != NULL)