Skip to content

Commit c8cb883

Browse files
committed
patch 8.2.1007: completion doesn't work after ":r ++arg !"
Problem: Completion doesn't work after ":r ++arg !". Solution: Skip over "++arg". (Christian Brabandt, closes #6275, closes #6258)
1 parent efd8855 commit c8cb883

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

src/cmdexpand.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,15 @@ set_one_cmd_context(
11461146
arg = skipwhite(arg);
11471147
}
11481148

1149+
// Skip over ++argopt argument
1150+
if ((ea.argt & EX_ARGOPT) && *arg != NUL && STRNCMP(arg, "++", 2) == 0)
1151+
{
1152+
p = arg;
1153+
while (*p && !vim_isspace(*p))
1154+
MB_PTR_ADV(p);
1155+
arg = skipwhite(p);
1156+
}
1157+
11491158
// Check for '|' to separate commands and '"' to start comments.
11501159
// Don't do this for ":read !cmd" and ":write !cmd".
11511160
if ((ea.argt & EX_TRLBAR) && !usefilter)

src/testdir/test_cmdline.vim

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,5 +1568,20 @@ func Test_zero_line_search()
15681568
q!
15691569
endfunc
15701570

1571+
func Test_read_shellcmd()
1572+
CheckUnix
1573+
if executable('ls')
1574+
" There should be ls in the $PATH
1575+
call feedkeys(":r! l\<c-a>\<c-b>\"\<cr>", 'tx')
1576+
call assert_match('^"r! .*\<ls\>', @:)
1577+
endif
1578+
1579+
if executable('rm')
1580+
call feedkeys(":r! ++enc=utf-8 r\<c-a>\<c-b>\"\<cr>", 'tx')
1581+
call assert_notmatch('^"r!.*\<runtest.vim\>', @:)
1582+
call assert_match('^"r!.*\<rm\>', @:)
1583+
endif
1584+
endfunc
1585+
15711586

15721587
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1007,
757759
/**/
758760
1006,
759761
/**/

0 commit comments

Comments
 (0)