fix(api): return "style" in nvim_win_get_config() #38122

Problem: nvim_win_get_config() does not return a window's "style".

Solution: always include it, and document `style=""`.

Always included so it can be used reciprocally with nvim_open_win() or
nvim_win_set_config(). (otherwise the config of a window with kWinStyleUnused
will not unset the kWinStyleMinimal style of another window if passed to
nvim_win_set_config, for example)
This commit is contained in:
Sean Dewar
2026-03-03 12:17:20 +00:00
committed by GitHub
parent 84d84e9b5b
commit 1901832f26
7 changed files with 76 additions and 16 deletions

View File

@@ -1436,6 +1436,7 @@ describe('float window', function()
local expected = {
anchor = 'NW',
border = 'none',
style = '',
col = 5,
external = false,
focusable = true,
@@ -1465,17 +1466,31 @@ describe('float window', function()
)
)
eq(
{ external = false, focusable = true, mouse = true, hide = false, relative = '', split = 'left', width = 40, height = 6 },
api.nvim_win_get_config(0)
)
eq({
external = false,
focusable = true,
mouse = true,
hide = false,
relative = '',
style = '',
split = 'left',
width = 40,
height = 6,
}, api.nvim_win_get_config(0))
if multigrid then
api.nvim_win_set_config(win, { external = true, width = 10, height = 1 })
eq(
{ external = true, focusable = true, mouse = true, width = 10, height = 1, relative = '', hide = false, border = 'none' },
api.nvim_win_get_config(win)
)
eq({
external = true,
focusable = true,
mouse = true,
width = 10,
height = 1,
relative = '',
style = '',
hide = false,
border = 'none',
}, api.nvim_win_get_config(win))
end
end)
@@ -4546,6 +4561,7 @@ describe('float window', function()
bufpos = { 1, 32 },
anchor = 'NW',
border = 'none',
style = '',
hide = false,
external = false,
col = 0,