]> granicus.if.org Git - vim/commitdiff
patch 8.2.1007: completion doesn't work after ":r ++arg !" v8.2.1007
authorBram Moolenaar <Bram@vim.org>
Thu, 18 Jun 2020 19:14:30 +0000 (21:14 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 18 Jun 2020 19:14:30 +0000 (21:14 +0200)
Problem:    Completion doesn't work after ":r ++arg !".
Solution:   Skip over "++arg". (Christian Brabandt, closes #6275,
            closes #6258)

src/cmdexpand.c
src/testdir/test_cmdline.vim
src/version.c

index 9508d669dd48eb70b892297fdb020a288043ab40..63f0cc7b152e82483e6e5a8770505971c0e005a1 100644 (file)
@@ -1146,6 +1146,15 @@ set_one_cmd_context(
        arg = skipwhite(arg);
     }
 
+    // Skip over ++argopt argument
+    if ((ea.argt & EX_ARGOPT) && *arg != NUL && STRNCMP(arg, "++", 2) == 0)
+    {
+       p = arg;
+       while (*p && !vim_isspace(*p))
+           MB_PTR_ADV(p);
+       arg = skipwhite(p);
+    }
+
     // Check for '|' to separate commands and '"' to start comments.
     // Don't do this for ":read !cmd" and ":write !cmd".
     if ((ea.argt & EX_TRLBAR) && !usefilter)
index eeb9c2f5485436c854132e384cf32b3d445b8436..5d772eacdcd2a2d1ffc680145ff663883dba3885 100644 (file)
@@ -1568,5 +1568,20 @@ func Test_zero_line_search()
   q!
 endfunc
 
+func Test_read_shellcmd()
+  CheckUnix
+  if executable('ls')
+    " There should be ls in the $PATH
+    call feedkeys(":r! l\<c-a>\<c-b>\"\<cr>", 'tx')
+    call assert_match('^"r! .*\<ls\>', @:)
+  endif
+
+  if executable('rm')
+    call feedkeys(":r! ++enc=utf-8 r\<c-a>\<c-b>\"\<cr>", 'tx')
+    call assert_notmatch('^"r!.*\<runtest.vim\>', @:)
+    call assert_match('^"r!.*\<rm\>', @:)
+  endif
+endfunc
+
 
 " vim: shiftwidth=2 sts=2 expandtab
index 080a8b159047103b656967434045cc1a358440f3..6ea02b95ad66de33b6f8fb6251199615084f7b8c 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1007,
 /**/
     1006,
 /**/