Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf40adf7

Browse files
authored
fix(inccommand): do not try to preview an ambiguous command (#18827)
1 parentc632f64 commitf40adf7

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

‎src/nvim/ex_docmd.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10133,9 +10133,8 @@ bool cmd_can_preview(char *cmd)
1013310133
if (*ea.cmd=='*') {
1013410134
ea.cmd=skipwhite(ea.cmd+1);
1013510135
}
10136-
find_ex_command(&ea,NULL);
1013710136

10138-
if (ea.cmdidx==CMD_SIZE) {
10137+
if (find_ex_command(&ea,NULL)==NULL||ea.cmdidx==CMD_SIZE) {
1013910138
return false;
1014010139
}elseif (!IS_USER_CMDIDX(ea.cmdidx)) {
1014110140
// find_ex_command sets the flags for user commands automatically

‎test/functional/ui/inccommand_user_spec.lua‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ local exec_lua = helpers.exec_lua
55
localinsert=helpers.insert
66
localfeed=helpers.feed
77
localcommand=helpers.command
8+
localassert_alive=helpers.assert_alive
89

910
-- Implements a :Replace command that works like :substitute.
1011
localsetup_replace_cmd=[[
@@ -326,4 +327,13 @@ describe("'inccommand' for user commands", function()
326327
:.Replace text cats^ |
327328
]])
328329
end)
330+
331+
it('does not crash on ambiguous command #18825',function()
332+
command('set inccommand=split')
333+
command('command Reply echo 1')
334+
feed(':R')
335+
assert_alive()
336+
feed('e')
337+
assert_alive()
338+
end)
329339
end)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp