fix(api): nvim_win_resize tweaks #40596

This commit is contained in:
Justin M. Keyes
2026-07-05 13:22:16 -04:00
committed by GitHub
parent 1f18ea1cf7
commit 8dfe4d6629
6 changed files with 43 additions and 59 deletions

View File

@@ -490,23 +490,20 @@ describe('API/win', function()
end
)
it('failure modes', function()
it('validation', function()
command('split')
eq("Required: 'height' or 'width'", pcall_err(api.nvim_win_resize, 0, -1, -1, {}))
eq(
"Required: must set at least one of 'height', 'width'",
pcall_err(api.nvim_win_resize, 0, -1, -1, {})
)
eq(
"Invalid 'width': expected a non-negative count of columns, or -1 for no change",
"Invalid 'width': expected non-negative number or -1",
pcall_err(api.nvim_win_resize, 0, -2, 5, {})
)
eq(
"Invalid 'height': expected a non-negative count of rows, or -1 for no change",
"Invalid 'height': expected non-negative number or -1",
pcall_err(api.nvim_win_resize, 0, 5, -2, {})
)
-- anchor not applicable to the dimension(s) being changed
eq(
"Conflict: 'left' not allowed with this dimension",
"Conflict: 'left' not allowed with 'width'",
pcall_err(api.nvim_win_resize, 0, -1, 5, { anchor = 'left' })
)
-- unrecognized anchor value