summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2024-01-12 17:34:40 +0100
committerChristian Brabandt <cb@256bit.org>2024-01-12 17:34:40 +0100
commit8610f74382039c9c54d6c4aeb978d252e762360a (patch)
tree039a6fbf21637fca9898082edef0b0a06af33aac /src
parentb52600d5613316e5b6e89514a02df1f97e27a5ff (diff)
patch 9.1.0019: cmdline may disappear when changing 'cmdheight'v9.1.0019
Problem: cmdline may disappear when changing 'cmdheight' (after Patch 9.0.0190, @markonm) Solution: always re-calculate the old_p_ch value, not only when cmdline_row was higher than expected fixes: #13822 closes: #13826 Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src')
-rw-r--r--src/testdir/test_cmdline.vim13
-rw-r--r--src/version.c2
-rw-r--r--src/window.c8
3 files changed, 19 insertions, 4 deletions
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 4554712670..ea95cbfce5 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -3742,4 +3742,17 @@ func Test_custom_completion_with_glob()
delfunc TestGlobComplete
endfunc
+func Test_window_size_stays_same_after_changing_cmdheight()
+ set laststatus=2
+ let expected = winheight(0)
+ function! Function_name() abort
+ call feedkeys(":"..repeat('x', &columns), 'x')
+ let &cmdheight=2
+ let &cmdheight=1
+ redraw
+ endfunction
+ call Function_name()
+ call assert_equal(expected, winheight(0))
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 675103fecd..627acd24d7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 19,
+/**/
18,
/**/
17,
diff --git a/src/window.c b/src/window.c
index 54e17be2db..e53ac71584 100644
--- a/src/window.c
+++ b/src/window.c
@@ -7131,17 +7131,17 @@ command_height(void)
// If the space for the command line is already more than 'cmdheight' there
// is nothing to do (window size must have decreased).
+ // Note: this makes curtab->tp_ch_used unreliable
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 + tabline_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
+ // old_p_ch may be unreliable, because of the early return above, so
+ // 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;
+ old_p_ch = Rows - cmdline_row;
// Find bottom frame with width of screen.
frp = lastwin->w_frame;