summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-10-05 15:42:32 +0100
committerBram Moolenaar <Bram@vim.org>2022-10-05 15:42:32 +0100
commit0816f473ab2f6cf7d8311c0f97371cada7f20d18 (patch)
tree46c3a0fe1d1a91ac6ca535b297ccc72e2d378354
parentf3ef026c9897f1d2e3fba47166a4771d507dae91 (diff)
patch 9.0.0665: setting 'cmdheight' has no effect if last window was resizedv9.0.0665
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)
-rw-r--r--src/option.c5
-rw-r--r--src/testdir/dumps/Test_changing_cmdheight_6.dump8
-rw-r--r--src/testdir/test_cmdline.vim11
-rw-r--r--src/version.c2
-rw-r--r--src/window.c5
5 files changed, 28 insertions, 3 deletions
diff --git a/src/option.c b/src/option.c
index 7d6b9547f6..1b8c3eae8c 100644
--- a/src/option.c
+++ b/src/option.c
@@ -3577,11 +3577,12 @@ set_num_option(
// Only compute the new window layout when startup has been
// 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
&& !gui.starting
#endif
- )
+ )
command_height();
}
diff --git a/src/testdir/dumps/Test_changing_cmdheight_6.dump b/src/testdir/dumps/Test_changing_cmdheight_6.dump
new file mode 100644
index 0000000000..fb2a5215ac
--- /dev/null
+++ b/src/testdir/dumps/Test_changing_cmdheight_6.dump
@@ -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
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 00939f9105..3cfdd76480 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -248,6 +248,13 @@ func Test_changing_cmdheight()
let lines =<< trim END
set cmdheight=1 laststatus=2
+ func EchoTwo()
+ set laststatus=2
+ set cmdheight=5
+ echo 'foo'
+ echo 'bar'
+ set cmdheight=1
+ endfunc
END
call writefile(lines, 'XTest_cmdheight', 'D')
@@ -272,6 +279,10 @@ func Test_changing_cmdheight()
call term_sendkeys(buf, ":set cmdheight=1\<CR>")
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
call StopVimInTerminal(buf)
endfunc
diff --git a/src/version.c b/src/version.c
index ed91d277ab..0f49ac275b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -700,6 +700,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 665,
+/**/
664,
/**/
663,
diff --git a/src/window.c b/src/window.c
index 52c458e033..79ff5a4269 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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
command_height(void)
@@ -6663,6 +6663,9 @@ command_height(void)
if (p_ch > old_p_ch && cmdline_row <= Rows - p_ch)
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'
// then set old_p_ch to what it would be, so that the windows get resized
// properly for the new value.