diff --git a/src/testdir/dumps/Test_changing_cmdheight_3.dump b/src/testdir/dumps/Test_changing_cmdheight_3.dump index d652cc63102f61..0adb5c6664b220 100644 --- a/src/testdir/dumps/Test_changing_cmdheight_3.dump +++ b/src/testdir/dumps/Test_changing_cmdheight_3.dump @@ -1,8 +1,8 @@ > +0&#ffffff0@74 -|~+0#4040ff13&| @73 -|[+3#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1 +|[+3&&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1 | +0&&@74 @75 @75 @75 @75 +@75 diff --git a/src/testdir/dumps/Test_changing_cmdheight_8.dump b/src/testdir/dumps/Test_changing_cmdheight_8.dump new file mode 100644 index 00000000000000..1b24f33413abb6 --- /dev/null +++ b/src/testdir/dumps/Test_changing_cmdheight_8.dump @@ -0,0 +1,8 @@ +> +0&#ffffff0@74 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|[+3#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1 +|:+0&&|w|i|n|c|m|d| |_| @65 +@75 diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index 2b81dc05a9cdff..dfebb400b53644 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -293,14 +293,13 @@ func Test_changing_cmdheight() " :resize now also changes 'cmdheight' accordingly call term_sendkeys(buf, ":set cmdheight+=1\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_2', {}) - call term_sendkeys(buf, ":set cmdheight-=1\") " using more space moves the status line up call term_sendkeys(buf, ":set cmdheight+=1\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_3', {}) " reducing cmdheight moves status line down - call term_sendkeys(buf, ":set cmdheight-=2\") + call term_sendkeys(buf, ":set cmdheight-=3\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_4', {}) " reducing window size and then setting cmdheight @@ -312,10 +311,14 @@ func Test_changing_cmdheight() call term_sendkeys(buf, ":call EchoTwo()\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_6', {}) - " decreasing 'cmdheight' doesn't clear the messages that need hit-enter + " increasing 'cmdheight' doesn't clear the messages that need hit-enter call term_sendkeys(buf, ":call EchoOne()\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_7', {}) + " window commands do not reduce 'cmdheight' to value lower than :set by user + call term_sendkeys(buf, "\:wincmd _\") + call VerifyScreenDump(buf, 'Test_changing_cmdheight_8', {}) + " clean up call StopVimInTerminal(buf) endfunc diff --git a/src/version.c b/src/version.c index e8feb96f40159d..60de70238c7d25 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 993, /**/ 992, /**/ diff --git a/src/window.c b/src/window.c index 93b0a327d64946..b15ad3eca83796 100644 --- a/src/window.c +++ b/src/window.c @@ -3832,6 +3832,10 @@ frame_has_win(frame_T *frp, win_T *wp) return FALSE; } +// 'cmdheight' value explicitly set by the user: window commands are allowed to +// resize the topframe to values higher than this minimum, but not lower. +static int min_set_ch = 1; + /* * Set a new height for a frame. Recursively sets the height for contained * frames and windows. Caller must take care of positions. @@ -3852,9 +3856,11 @@ frame_new_height( if (topfrp->fr_parent == NULL && set_ch) { // topframe: update the command line height, with side effects. - int new_ch = MAX(1, p_ch + topfrp->fr_height - height); + int new_ch = MAX(min_set_ch, p_ch + topfrp->fr_height - height); + int save_ch = min_set_ch; if (new_ch != p_ch) set_option_value((char_u *)"cmdheight", new_ch, NULL, 0); + min_set_ch = save_ch; height = MIN(height, ROWS_AVAIL); } if (topfrp->fr_win != NULL) @@ -7306,7 +7312,7 @@ command_height(void) old_p_ch += h; frp = frp->fr_prev; } - if (p_ch < old_p_ch && command_frame_height) + if (p_ch < old_p_ch && command_frame_height && frp != NULL) frame_add_height(frp, (int)(old_p_ch - p_ch)); // Recompute window positions. @@ -7325,6 +7331,7 @@ command_height(void) // GUI starts up, we can't be sure in what order things happen. And when // p_ch was changed in another tab page. curtab->tp_ch_used = p_ch; + min_set_ch = p_ch; } /*