mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
fix(inccommand): do not try to preview an ambiguous command (#18827)
This commit is contained in:
@@ -10133,9 +10133,8 @@ bool cmd_can_preview(char *cmd)
|
|||||||
if (*ea.cmd == '*') {
|
if (*ea.cmd == '*') {
|
||||||
ea.cmd = skipwhite(ea.cmd + 1);
|
ea.cmd = skipwhite(ea.cmd + 1);
|
||||||
}
|
}
|
||||||
find_ex_command(&ea, NULL);
|
|
||||||
|
|
||||||
if (ea.cmdidx == CMD_SIZE) {
|
if (find_ex_command(&ea, NULL) == NULL || ea.cmdidx == CMD_SIZE) {
|
||||||
return false;
|
return false;
|
||||||
} else if (!IS_USER_CMDIDX(ea.cmdidx)) {
|
} else if (!IS_USER_CMDIDX(ea.cmdidx)) {
|
||||||
// find_ex_command sets the flags for user commands automatically
|
// find_ex_command sets the flags for user commands automatically
|
||||||
|
@@ -5,6 +5,7 @@ local exec_lua = helpers.exec_lua
|
|||||||
local insert = helpers.insert
|
local insert = helpers.insert
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
|
local assert_alive = helpers.assert_alive
|
||||||
|
|
||||||
-- Implements a :Replace command that works like :substitute.
|
-- Implements a :Replace command that works like :substitute.
|
||||||
local setup_replace_cmd = [[
|
local setup_replace_cmd = [[
|
||||||
@@ -326,4 +327,13 @@ describe("'inccommand' for user commands", function()
|
|||||||
:.Replace text cats^ |
|
:.Replace text cats^ |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('does not crash on ambiguous command #18825', function()
|
||||||
|
command('set inccommand=split')
|
||||||
|
command('command Reply echo 1')
|
||||||
|
feed(':R')
|
||||||
|
assert_alive()
|
||||||
|
feed('e')
|
||||||
|
assert_alive()
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
Reference in New Issue
Block a user