fix(api): preserve WinConfig style when converting float to split #37264

Problem: When a float window with style='minimal' is converted to a
split window and then changes buffer, the minimal style options get
overridden. This happens because merge_win_config() clears the style
field, so get_winopts() doesn't know to re-apply minimal style after
restoring options from the buffer's wininfo.

Solution: Save and restore the style field when clearing the config
during float-to-split conversion.
This commit is contained in:
glepnir
2026-02-13 09:23:30 +08:00
committed by GitHub
parent cc7022c544
commit 88dc44260f
2 changed files with 32 additions and 0 deletions

View File

@@ -3478,5 +3478,34 @@ describe('API/win', function()
pcall_err(api.nvim_win_set_config, old_curwin, { win = other_tp_win, split = 'right' })
)
end)
it('minimal style persists through float-to-split and buffer change #37067', function()
-- Set all options globally
command('set number relativenumber cursorline cursorcolumn spell list')
command('set signcolumn=yes colorcolumn=80 statuscolumn=%l foldcolumn=2')
local buf1 = api.nvim_create_buf(false, true)
local win = api.nvim_open_win(buf1, true, {
relative = 'editor',
width = 10,
height = 10,
row = 5,
col = 5,
style = 'minimal',
})
-- Convert to split then change buffer
api.nvim_win_set_config(win, { split = 'below', win = -1 })
local buf2 = api.nvim_create_buf(false, true)
api.nvim_win_set_buf(win, buf2)
eq(false, api.nvim_get_option_value('number', { win = win }))
eq(false, api.nvim_get_option_value('relativenumber', { win = win }))
eq(false, api.nvim_get_option_value('cursorline', { win = win }))
eq(false, api.nvim_get_option_value('cursorcolumn', { win = win }))
eq(false, api.nvim_get_option_value('spell', { win = win }))
eq(false, api.nvim_get_option_value('list', { win = win }))
eq('0', api.nvim_get_option_value('foldcolumn', { win = win }))
eq('auto', api.nvim_get_option_value('signcolumn', { win = win }))
eq('', api.nvim_get_option_value('colorcolumn', { win = win }))
eq('', api.nvim_get_option_value('statuscolumn', { win = win }))
end)
end)
end)