fix(api): don't use 'winborder' when reconfiguring float (#32984)

Problem: Reconfiguring a float window applies the global 'winborder'.
Solution:
- Ignore 'winborder' when reconfiguring a float window.
- Still apply 'winborder' when converting a split to a float window.
This commit is contained in:
glepnir
2025-03-19 20:16:20 +08:00
committed by GitHub
parent 74fcc9452c
commit 0e59f6f4c7
3 changed files with 39 additions and 2 deletions

View File

@@ -1907,6 +1907,38 @@ describe('API/win', function()
end)
describe('set_config', function()
it("uses 'winborder' when converting a split to a floating window", function()
api.nvim_set_option_value('winborder', 'single', {})
command('split')
local winid = api.nvim_get_current_win()
-- Convert split to float without specifying border
api.nvim_win_set_config(winid, {
relative = 'editor',
row = 2,
col = 2,
width = 10,
height = 5,
})
local config = api.nvim_win_get_config(winid)
eq('', config.border[1])
end)
it('erases border of a floating window when converting to split window', function()
api.nvim_set_option_value('winborder', 'single', {})
local winid = api.nvim_open_win(api.nvim_create_buf(false, false), false, {
relative = 'editor',
row = 2,
col = 2,
width = 10,
height = 5,
})
local config = api.nvim_win_get_config(winid)
eq('', config.border[1])
api.nvim_win_set_config(winid, { split = 'right', win = 0 })
config = api.nvim_win_get_config(winid)
eq(nil, config.border)
end)
it('moves a split into a float', function()
local win = api.nvim_open_win(0, true, {
vertical = false,