CheckScreendump
" Test CTRL-W__ with global stlo maxheight:3 and multi-line statusline.
- " After maximizing, the large window should keep stlh=3, not collapse to 1
- " because the minimized other window constrained global_stlh.
+ " The height is computed when 'stlo' is set (a single window here, so 3).
+ " Splitting and maximizing do not recompute it, so both status lines stay 3.
let lines =<< trim END
set laststatus=2
set statuslineopt=maxheight:3
call StopVimInTerminal(buf)
endfunc
+func Test_statuslineopt_wincmd_underscore_besteff()
+ CheckScreendump
+
+ " Best effort when global 'stlo' is set after CTRL-W__ has minimized the
+ " other window. That window only fits a 1-row status line, so the global
+ " height is reduced to 1 even though maxheight is 3.
+ let lines =<< trim END
+ set laststatus=2
+ set statusline=GA%@GB%@GC
+ new
+ wincmd _
+ END
+ call writefile(lines, 'XTest_statuslineopt_wincmd_underscore_besteff', 'D')
+
+ let buf = g:RunVimInTerminal('-S XTest_statuslineopt_wincmd_underscore_besteff', {'rows': 14})
+ call term_sendkeys(buf, ":set statuslineopt=maxheight:3\<CR>\<C-L>")
+ call VerifyScreenDump(buf, 'Test_statuslineopt_wincmd_underscore_besteff_01', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
def Test_statuslineopt_besteff_order()
# Test the best-effort option update: keyword order is preserved and
# duplicate maxheight: removed.
win_T *wp = frp->fr_win;
// Only consider windows with a status line that use global stlo.
- // Exclude windows at minimum height (w_height <= p_wmh): they can
- // only afford 1 status line row anyway, and should not constrain
- // the global stlh for larger windows (e.g. after CTRL-W__).
- if (wp->w_height > p_wmh && wp->w_status_height > 0
+ // Every such window constrains the global height (best effort): the
+ // result is the largest height that still fits every window.
+ if (wp->w_height > 0 && wp->w_status_height > 0
&& *wp->w_p_stlo == NUL)
{
int win_free_height = frp->fr_height - WINBAR_HEIGHT(wp);