Patch 9.0.0190
Problem:    The way 'cmdheight' can be made zero is inconsistent.
Solution:   Only make 'cmdheight' zero when setting it explicitly, not when
            resizing windows. (closes #10890)
Files:      src/window.c, src/testdir/test_cmdline.vim,
            src/testdir/dumps/Test_changing_cmdheight_1.dump,
            src/testdir/dumps/Test_changing_cmdheight_2.dump,
            src/testdir/dumps/Test_changing_cmdheight_3.dump,
            src/testdir/dumps/Test_changing_cmdheight_4.dump


*** ../vim-9.0.0189/src/window.c        2022-08-10 17:23:08.983907034 +0100
--- src/window.c        2022-08-11 13:06:14.035057384 +0100
***************
*** 5702,5708 ****
  
      if (curfrp->fr_parent == NULL)
      {
!       // topframe: can only change the command line
        if (height > ROWS_AVAIL)
            // If height is greater than the available space, try to create
            // space for the frame by reducing 'cmdheight' if possible, while
--- 5702,5708 ----
  
      if (curfrp->fr_parent == NULL)
      {
!       // topframe: can only change the command line height
        if (height > ROWS_AVAIL)
            // If height is greater than the available space, try to create
            // space for the frame by reducing 'cmdheight' if possible, while
***************
*** 6089,6094 ****
--- 6089,6100 ----
      int               row;
      int               up;     // if TRUE, drag status line up, otherwise down
      int               n;
+     static int        p_ch_was_zero = FALSE;
+ 
+     // If the user explicitly set 'cmdheight' to zero, then allow for dragging
+     // the status line making it zero again.
+     if (p_ch == 0)
+       p_ch_was_zero = TRUE;
  
      fr = dragwin->w_frame;
      curfr = fr;
***************
*** 6147,6152 ****
--- 6153,6160 ----
        room = Rows - cmdline_row;
        if (curfr->fr_next != NULL)
            room -= p_ch;
+       else if (!p_ch_was_zero)
+           --room;
        if (room < 0)
            room = 0;
        // sum up the room of frames below of the current one
***************
*** 6196,6202 ****
      row = win_comp_pos();
      screen_fill(row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);
      cmdline_row = row;
!     p_ch = MAX(Rows - cmdline_row, 0);
      curtab->tp_ch_used = p_ch;
      redraw_all_later(SOME_VALID);
      showmode();
--- 6204,6210 ----
      row = win_comp_pos();
      screen_fill(row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);
      cmdline_row = row;
!     p_ch = MAX(Rows - cmdline_row, p_ch_was_zero ? 0 : 1);
      curtab->tp_ch_used = p_ch;
      redraw_all_later(SOME_VALID);
      showmode();
***************
*** 6542,6547 ****
--- 6550,6560 ----
      // p_ch was changed in another tab page.
      curtab->tp_ch_used = p_ch;
  
+     // If the space for the command line is already more than 'cmdheight' 
there
+     // is nothing to do (window size must have decreased).
+     if (p_ch > old_p_ch && cmdline_row <= Rows - p_ch)
+       return;
+ 
      // Find bottom frame with width of screen.
      frp = lastwin->w_frame;
      while (frp->fr_width != Columns && frp->fr_parent != NULL)
*** ../vim-9.0.0189/src/testdir/test_cmdline.vim        2022-08-06 
10:28:15.665426324 +0100
--- src/testdir/test_cmdline.vim        2022-08-11 13:11:43.347100502 +0100
***************
*** 215,220 ****
--- 215,249 ----
    call delete('XTest_redraw')
  endfunc
  
+ func Test_changing_cmdheight()
+   CheckScreendump
+ 
+   let lines =<< trim END
+       set cmdheight=1 laststatus=2
+   END
+   call writefile(lines, 'XTest_cmdheight')
+ 
+   let buf = RunVimInTerminal('-S XTest_cmdheight', {'rows': 8})
+   call term_sendkeys(buf, ":resize -3\<CR>")
+   call VerifyScreenDump(buf, 'Test_changing_cmdheight_1', {})
+ 
+   " using the space available doesn't change the status line
+   call term_sendkeys(buf, ":set cmdheight+=3\<CR>")
+   call VerifyScreenDump(buf, 'Test_changing_cmdheight_2', {})
+ 
+   " using more space moves the status line up
+   call term_sendkeys(buf, ":set cmdheight+=1\<CR>")
+   call VerifyScreenDump(buf, 'Test_changing_cmdheight_3', {})
+ 
+   " reducing cmdheight moves status line down
+   call term_sendkeys(buf, ":set cmdheight-=2\<CR>")
+   call VerifyScreenDump(buf, 'Test_changing_cmdheight_4', {})
+ 
+   " clean up
+   call StopVimInTerminal(buf)
+   call delete('XTest_cmdheight')
+ endfunc
+ 
  func Test_map_completion()
    call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt')
    call assert_equal('"map <unique> <silent>', getreg(':'))
*** ../vim-9.0.0189/src/testdir/dumps/Test_changing_cmdheight_1.dump    
2022-08-11 13:15:43.831042167 +0100
--- src/testdir/dumps/Test_changing_cmdheight_1.dump    2022-08-11 
13:11:50.363099644 +0100
***************
*** 0 ****
--- 1,8 ----
+ > +0&#ffffff0@74
+ |~+0#4040ff13&| @73
+ |~| @73
+ |[+3#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+ | +0&&@74
+ @75
+ @75
+ |:|r|e|s|i|z|e| |-|3| @64
*** ../vim-9.0.0189/src/testdir/dumps/Test_changing_cmdheight_2.dump    
2022-08-11 13:15:43.839042164 +0100
--- src/testdir/dumps/Test_changing_cmdheight_2.dump    2022-08-11 
13:11:51.511099498 +0100
***************
*** 0 ****
--- 1,8 ----
+ > +0&#ffffff0@74
+ |~+0#4040ff13&| @73
+ |~| @73
+ |[+3#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+ |:+0&&|s|e|t| |c|m|d|h|e|i|g|h|t|+|=|3| @57
+ @75
+ @75
+ @75
*** ../vim-9.0.0189/src/testdir/dumps/Test_changing_cmdheight_3.dump    
2022-08-11 13:15:43.843042161 +0100
--- src/testdir/dumps/Test_changing_cmdheight_3.dump    2022-08-11 
13:11:52.663099350 +0100
***************
*** 0 ****
--- 1,8 ----
+ > +0&#ffffff0@74
+ |~+0#4040ff13&| @73
+ |[+3#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+ | +0&&@74
+ @75
+ @75
+ @75
+ @75
*** ../vim-9.0.0189/src/testdir/dumps/Test_changing_cmdheight_4.dump    
2022-08-11 13:15:43.847042162 +0100
--- src/testdir/dumps/Test_changing_cmdheight_4.dump    2022-08-11 
13:11:53.815099201 +0100
***************
*** 0 ****
--- 1,8 ----
+ > +0&#ffffff0@74
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |[+3#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+ | +0&&@74
+ @75
+ @75
*** ../vim-9.0.0189/src/version.c       2022-08-10 20:50:04.233565227 +0100
--- src/version.c       2022-08-11 12:29:54.080642707 +0100
***************
*** 737,738 ****
--- 737,740 ----
  {   /* Add new patch number below this line */
+ /**/
+     190,
  /**/

-- 
Microsoft's definition of a boolean: TRUE, FALSE, MAYBE
"Embrace and extend"...?

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220811121817.9F0F91C4F15%40moolenaar.net.

Raspunde prin e-mail lui