fix(api): make win_set_config with "win" for splits need "split/vertical"

Problem: currently, for splits, nvim_win_set_config accepts win without any of
split or vertical set, which has little effect and seems error-prone.

Solution: require at least one of split or vertical to also be set for splits.

Also, update nvim_win_set_config docs, as it's no longer limited to just
floating and external windows.
This commit is contained in:
Sean Dewar
2024-02-07 21:44:42 +00:00
committed by Sean Dewar
parent 5d58136ccc
commit b1577d371a
4 changed files with 27 additions and 14 deletions

View File

@@ -1727,6 +1727,15 @@ describe('API/win', function()
config = api.nvim_win_get_config(win)
eq('', config.relative)
eq('below', config.split)
eq(
"non-float with 'win' requires at least 'split' or 'vertical'",
pcall_err(api.nvim_win_set_config, 0, { win = 0 })
)
eq(
"non-float with 'win' requires at least 'split' or 'vertical'",
pcall_err(api.nvim_win_set_config, 0, { win = 0, relative = '' })
)
end)
it('creates top-level splits', function()