mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 22:38:16 +00:00
fix(inccommand): avoid crash if callback changes inccommand option (#18830)
clang: Result of operation is garbage or undefined clang: Uninitialized argument value Also check for == 's' instead of != 'n' as it is more straightforward. Also fix another unrelated PVS warning: PVS/V1071: Return value of win_comp_pos() is not always used
This commit is contained in:
@@ -336,4 +336,21 @@ describe("'inccommand' for user commands", function()
|
||||
feed('e')
|
||||
assert_alive()
|
||||
end)
|
||||
|
||||
it('no crash if preview callback changes inccommand option', function()
|
||||
command('set inccommand=nosplit')
|
||||
exec_lua([[
|
||||
vim.api.nvim_create_user_command('Replace', function() end, {
|
||||
nargs = '*',
|
||||
preview = function()
|
||||
vim.api.nvim_set_option('inccommand', 'split')
|
||||
return 2
|
||||
end,
|
||||
})
|
||||
]])
|
||||
feed(':R')
|
||||
assert_alive()
|
||||
feed('e')
|
||||
assert_alive()
|
||||
end)
|
||||
end)
|
||||
|
Reference in New Issue
Block a user