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
// 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;