mirror of
https://github.com/neovim/neovim.git
synced 2026-03-31 12:52:13 +00:00
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:
@@ -3332,6 +3332,46 @@ describe('API/win', function()
|
||||
eq('right', api.nvim_win_get_config(win2).split)
|
||||
eq('right', api.nvim_win_get_config(float).split)
|
||||
end)
|
||||
|
||||
it('includes style', function()
|
||||
local unused_style1 = api.nvim_open_win(0, false, {
|
||||
width = 10,
|
||||
height = 10,
|
||||
relative = 'editor',
|
||||
row = 10,
|
||||
col = 10,
|
||||
})
|
||||
local unused_style2 = api.nvim_open_win(0, false, {
|
||||
width = 10,
|
||||
height = 10,
|
||||
relative = 'editor',
|
||||
row = 10,
|
||||
col = 10,
|
||||
style = '',
|
||||
})
|
||||
local minimal_style = api.nvim_open_win(0, false, {
|
||||
width = 10,
|
||||
height = 10,
|
||||
relative = 'editor',
|
||||
row = 10,
|
||||
col = 10,
|
||||
style = 'minimal',
|
||||
})
|
||||
|
||||
eq('', api.nvim_win_get_config(unused_style1).style)
|
||||
eq('', api.nvim_win_get_config(unused_style2).style)
|
||||
eq('minimal', api.nvim_win_get_config(minimal_style).style)
|
||||
|
||||
-- "style" is allowed for splits too.
|
||||
eq('', api.nvim_win_get_config(0).relative)
|
||||
eq('', api.nvim_win_get_config(0).style)
|
||||
api.nvim_win_set_config(0, { style = 'minimal' })
|
||||
eq('minimal', api.nvim_win_get_config(0).style)
|
||||
api.nvim_win_set_config(0, { height = 1 }) -- "style" unchanged when not included.
|
||||
eq('minimal', api.nvim_win_get_config(0).style)
|
||||
api.nvim_win_set_config(0, { style = '' })
|
||||
eq('', api.nvim_win_get_config(0).style)
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('set_config', function()
|
||||
|
||||
Reference in New Issue
Block a user