From 8c311386c3488981364685c381d74d951575a204 Mon Sep 17 00:00:00 2001 From: Sean Dewar <6256228+seandewar@users.noreply.github.com> Date: Wed, 3 Sep 2025 16:44:07 +0100 Subject: [PATCH] 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. (cherry picked from commit bf5f7c1591d00d0253e8de25381a14bfaf4b4743) --- src/nvim/window.c | 2 +- test/functional/ui/statusline_spec.lua | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/nvim/window.c b/src/nvim/window.c index 3669179b66..a94e2cc126 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -3359,7 +3359,7 @@ void winframe_restore(win_T *wp, int dir, frame_T *unflat_altfr) if (frp->fr_parent->fr_layout == FR_COL && frp->fr_prev != NULL) { if (global_stl_height() == 0 && wp->w_status_height == 0) { frame_add_statusline(frp->fr_prev); - } else if (wp->w_hsep_height == 0) { + } else if (global_stl_height() > 0 && wp->w_hsep_height == 0) { frame_add_hsep(frp->fr_prev); } } diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua index 50e31ac6a9..bd27c97430 100644 --- a/test/functional/ui/statusline_spec.lua +++ b/test/functional/ui/statusline_spec.lua @@ -504,6 +504,20 @@ describe('global statusline', function() {3:[No Name] 0,0-1 All}| | ]]) + + -- Shouldn't gain a hsep if the global statusline is turned off. + command('set laststatus=2') + eq('Vim(wincmd):E36: Not enough room', pcall_err(command, 'wincmd L')) + command('mode') + screen:expect([[ + | + {1:~ }|*5 + {2:[No Name] 0,0-1 All}| + ^ | + {1:~ }|*6 + {3:[No Name] 0,0-1 All}| + | + ]]) end) end)