0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 9.0.0665: setting 'cmdheight' has no effect if last window was resized

Problem:    Setting 'cmdheight' has no effect if last window was resized.
Solution:   Do apply 'cmdheight' when told to.  Use the frame height instead
            of the cmdline_row.  (closes #11286)
This commit is contained in:
Bram Moolenaar
2022-10-05 15:42:32 +01:00
parent f3ef026c98
commit 0816f473ab
5 changed files with 28 additions and 3 deletions

View File

@@ -3577,7 +3577,8 @@ set_num_option(
// Only compute the new window layout when startup has been // Only compute the new window layout when startup has been
// completed. Otherwise the frame sizes may be wrong. // completed. Otherwise the frame sizes may be wrong.
if (p_ch != old_value && full_screen if ((p_ch != old_value || topframe->fr_height != Rows - p_ch)
&& full_screen
#ifdef FEAT_GUI #ifdef FEAT_GUI
&& !gui.starting && !gui.starting
#endif #endif

View File

@@ -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

View File

@@ -248,6 +248,13 @@ func Test_changing_cmdheight()
let lines =<< trim END let lines =<< trim END
set cmdheight=1 laststatus=2 set cmdheight=1 laststatus=2
func EchoTwo()
set laststatus=2
set cmdheight=5
echo 'foo'
echo 'bar'
set cmdheight=1
endfunc
END END
call writefile(lines, 'XTest_cmdheight', 'D') call writefile(lines, 'XTest_cmdheight', 'D')
@@ -272,6 +279,10 @@ func Test_changing_cmdheight()
call term_sendkeys(buf, ":set cmdheight=1\<CR>") call term_sendkeys(buf, ":set cmdheight=1\<CR>")
call VerifyScreenDump(buf, 'Test_changing_cmdheight_5', {}) call VerifyScreenDump(buf, 'Test_changing_cmdheight_5', {})
" setting 'cmdheight' works after outputting two messages
call term_sendkeys(buf, ":call EchoTwo()\<CR>")
call VerifyScreenDump(buf, 'Test_changing_cmdheight_6', {})
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
endfunc endfunc

View File

@@ -699,6 +699,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
665,
/**/ /**/
664, 664,
/**/ /**/

View File

@@ -6644,7 +6644,7 @@ win_comp_scroll(win_T *wp)
} }
/* /*
* command_height: called whenever p_ch has been changed * Command_height: called whenever p_ch has been changed.
*/ */
void void
command_height(void) command_height(void)
@@ -6663,6 +6663,9 @@ command_height(void)
if (p_ch > old_p_ch && cmdline_row <= Rows - p_ch) if (p_ch > old_p_ch && cmdline_row <= Rows - p_ch)
return; return;
// Update cmdline_row to what it should be: just below the last window.
cmdline_row = topframe->fr_height;
// If cmdline_row is smaller than what it is supposed to be for 'cmdheight' // 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 // then set old_p_ch to what it would be, so that the windows get resized
// properly for the new value. // properly for the new value.