fix(floatwin): handle viewport width properly at end of window (#35490)

Also avoid repeated calls of compute_foldcolumn().
This commit is contained in:
zeertzjq
2025-08-27 19:27:50 +08:00
committed by GitHub
parent 117b129378
commit 9269a1da35
2 changed files with 54 additions and 8 deletions

View File

@@ -1008,6 +1008,7 @@ describe('float window', function()
[29] = { background = Screen.colors.Yellow1, foreground = Screen.colors.Blue4 },
[30] = { background = Screen.colors.Grey, foreground = Screen.colors.Blue4, bold = true },
[31] = { foreground = Screen.colors.Grey0 },
[32] = { background = Screen.colors.LightMagenta, foreground = Screen.colors.Brown },
}
screen:set_default_attr_ids(attrs)
end)
@@ -3115,6 +3116,42 @@ describe('float window', function()
end
end)
it('border is drawn properly when number column is too wide #35431', function()
local buf = api.nvim_create_buf(false, false)
local opts = { relative = 'editor', row = 1, col = 1, width = 3, height = 3, border = 'rounded' }
local win = api.nvim_open_win(buf, false, opts)
api.nvim_set_option_value('number', true, { win = win })
if multigrid then
screen:expect({
grid = [[
## grid 1
[2:----------------------------------------]|*6
[3:----------------------------------------]|
## grid 2
^ |
{0:~ }|*5
## grid 3
|
## grid 4
{5:╭───╮}|
{5:│}{32: 1}{5:│}|
{5:│}{32: }{5:│}|*2
{5:╰───╯}|
]],
float_pos = { [4] = { 1001, 'NW', 1, 1, 1, true, 50, 1, 1, 1 } },
})
else
screen:expect([[
^ |
{0:~}{5:╭───╮}{0: }|
{0:~}{5:│}{32: 1}{5:│}{0: }|
{0:~}{5:│}{32: }{5:│}{0: }|*2
{0:~}{5:╰───╯}{0: }|
|
]])
end
end)
it('show ruler of current floating window', function()
command 'set ruler'
local buf = api.nvim_create_buf(false, false)