mirror of
https://github.com/neovim/neovim.git
synced 2026-03-29 20:02:03 +00:00
fix(api): merge split window config only on success
Problem: nvim_win_set_config may merge configs despite failing to configure a split, and without applying necessary side-effects (like setting style=minimal options). Plus, autocommands may apply a different config after the merge, causing side-effects to apply for an outdated config. Solution: merge configs last, only on success. Include fields only relevant to splits. Properly set _cmdline_offset for splits. Maybe better to disallow _cmdline_offset for splits instead, as the pum is relative to cmdline_row anyway? (I didn't want to change behaviour too much) Also use expect_unchanged in an unrelated test to quash a warning.
This commit is contained in:
@@ -390,6 +390,12 @@ describe('vim.ui_attach', function()
|
||||
9 bufname( {12: } |
|
||||
Excommand:call bufadd^( |
|
||||
]])
|
||||
-- _cmdline_offset remains set after being turned into a split.
|
||||
exec_lua(function()
|
||||
vim.fn.win_execute(_G.win, 'wincmd J')
|
||||
end)
|
||||
feed('<Tab>') -- Was a signed int overflow; offset was INT_MAX despite cmdline_win being set.
|
||||
eq(9, exec_lua('return vim.api.nvim_win_get_config(_G.win)._cmdline_offset'))
|
||||
-- No crash after _cmdline_offset window is closed #35584.
|
||||
exec_lua(function()
|
||||
vim.ui_detach(_G.ns)
|
||||
|
||||
Reference in New Issue
Block a user