vim-patch:9.1.1831: stray vseps in right-most 'winfixwidth' window

Problem:  vertical separator of 'winfixwidth' windows may remain if they
          become right-most windows from closing windows to the right.
Solution: Don't implicitly rely on frame_new_width to fix vseps, as the
          call may be skipped for 'winfixwidth' windows to preserve
          their width; do it explicitly in winframe_remove (Sean Dewar).

Note that I prefer win_new_width here over setting w_width directly, which
would've previously been done by win_split_ins after frame_add_vsep, as this
wasn't true for winframe_remove.

Though the equivalent issue of bottom 'winfixheight' windows leaving stray
statuslines with &ls=0 doesn't seem to exist, test it anyway.

closes: vim/vim#18481

620c655677

Nvim: calling win_new_width over setting w_width directly is especially
important in making sure stuff like w_view_width is correct here.

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
This commit is contained in:
Sean Dewar
2025-10-05 18:17:43 +01:00
parent a4a8838178
commit 7923e847ca
3 changed files with 116 additions and 8 deletions

View File

@@ -1,11 +1,14 @@
local t = require('test.testutil')
local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local clear = n.clear
local eq = t.eq
local exec = n.exec
local exec_lua = n.exec_lua
local command = n.command
local feed = n.feed
local fn = n.fn
-- oldtest: Test_window_cmd_ls0_split_scrolling()
it('scrolling with laststatus=0 and :botright split', function()
@@ -354,3 +357,53 @@ describe('splitkeep', function()
]])
end)
end)
-- oldtest: Test_winfixsize_vsep_statusline()
it("'winfixwidth/height' does not leave stray vseps/statuslines", function()
clear()
local screen = Screen.new(75, 8)
exec([[
set noequalalways splitbelow splitright
vsplit
setlocal winfixwidth
vsplit
]])
eq(16, fn.winwidth(1))
eq(37, fn.winwidth(2))
eq(20, fn.winwidth(3))
command('quit')
screen:expect([[
^ │ |
{1:~ }│{1:~ }|*5
{3:[No Name] }{2:[No Name] }|
|
]])
-- Checks w_view_width in Nvim; especially important as the screen test may still pass if only
-- w_width changed to make room for the vsep.
eq(36, fn.winwidth(1))
eq(38, fn.winwidth(2))
exec([[
set laststatus=0
only
split
set winfixheight
split
]])
eq(1, fn.winheight(1))
eq(3, fn.winheight(2))
eq(1, fn.winheight(3))
command('quit')
screen:expect([[
^ |
{1:~ }|
{3:[No Name] }|
|
{1:~ }|*3
|
]])
eq(2, fn.winheight(1))
eq(4, fn.winheight(2))
end)