Skip to content

Commit bf5f7c1

Browse files
committed
fix(window): don't add a hsep when out of room if global stl is off
Problem: a horizontal separator may be added to a window that doesn't need one if there is no room when moving a different window. Solution: only restore a hsep in winframe_restore when the global statusline is enabled.
1 parent 1f7d6c3 commit bf5f7c1

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/nvim/window.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3412,7 +3412,7 @@ void winframe_restore(win_T *wp, int dir, frame_T *unflat_altfr)
34123412
if (frp->fr_parent->fr_layout == FR_COL && frp->fr_prev != NULL) {
34133413
if (global_stl_height() == 0 && wp->w_status_height == 0) {
34143414
frame_add_statusline(frp->fr_prev);
3415-
} else if (wp->w_hsep_height == 0) {
3415+
} else if (global_stl_height() > 0 && wp->w_hsep_height == 0) {
34163416
frame_add_hsep(frp->fr_prev);
34173417
}
34183418
}

test/functional/ui/statusline_spec.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,20 @@ describe('global statusline', function()
504504
{3:[No Name] 0,0-1 All}|
505505
|
506506
]])
507+
508+
-- Shouldn't gain a hsep if the global statusline is turned off.
509+
command('set laststatus=2')
510+
eq('Vim(wincmd):E36: Not enough room', pcall_err(command, 'wincmd L'))
511+
command('mode')
512+
screen:expect([[
513+
|
514+
{1:~ }|*5
515+
{2:[No Name] 0,0-1 All}|
516+
^ |
517+
{1:~ }|*6
518+
{3:[No Name] 0,0-1 All}|
519+
|
520+
]])
507521
end)
508522
end)
509523

0 commit comments

Comments
 (0)