fix(api): don't config split as floatwin relative to itself

Problem: possible to configure a split as a floatwin with relative=win that is
relative to itself.

Solution: fix the check.

Not caused by this PR; just something I noticed when about to fix the validation
logic.
This commit is contained in:
Sean Dewar
2026-03-11 09:46:28 +00:00
parent c924c2a7b3
commit ef084b5c22
2 changed files with 4 additions and 1 deletions

View File

@@ -1360,7 +1360,7 @@ static bool parse_win_config(win_T *wp, Dict(win_config) *config, WinConfig *fco
}
if (relative_is_win || is_split) {
if (reconf && relative_is_win) {
if (wp && relative_is_win) {
win_T *target_win = find_window_by_handle(config->win, err);
if (!target_win) {
goto fail;

View File

@@ -11191,6 +11191,9 @@ describe('float window', function()
local winid = api.nvim_open_win(buf, false, config)
api.nvim_set_current_win(winid)
eq('floating window cannot be relative to itself', pcall_err(api.nvim_win_set_config, winid, config))
-- Also when configuring split into float.
command('split')
eq('floating window cannot be relative to itself', pcall_err(api.nvim_win_set_config, 0, config))
end)
it('bufpos out of range', function()