]> granicus.if.org Git - vim/commitdiff
patch 9.0.0089: fuzzy argument completion doesn't work for shell commands v9.0.0089
authorYegappan Lakshmanan <yegappan@yahoo.com>
Tue, 26 Jul 2022 21:01:36 +0000 (22:01 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 26 Jul 2022 21:01:36 +0000 (22:01 +0100)
Problem:    Fuzzy argument completion doesn't work for shell commands.
Solution:   Check for cmdidx not being CMD_bang. (Yegappan Lakshmanan,
            closes #10769)

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

index 28ecaeda976ab3d791ce9f716d034af3d680d0b3..793a104d06940294460260788314b84c3941e761 100644 (file)
@@ -1305,8 +1305,10 @@ set_cmd_index(char_u *cmd, exarg_T *eap, expand_T *xp, int *complp)
        eap->cmdidx = excmd_get_cmdidx(cmd, len);
 
        // User defined commands support alphanumeric characters.
-       // Also when doing fuzzy expansion, support alphanumeric characters.
-       if ((cmd[0] >= 'A' && cmd[0] <= 'Z') || (fuzzy && *p != NUL))
+       // Also when doing fuzzy expansion for non-shell commands, support
+       // alphanumeric characters.
+       if ((cmd[0] >= 'A' && cmd[0] <= 'Z')
+               || (fuzzy && eap->cmdidx != CMD_bang && *p != NUL))
            while (ASCII_ISALNUM(*p) || *p == '*')      // Allow * wild card
                ++p;
     }
index e1ee6336d30ec07179edfb43df56da4d7f2429df..cd9aa277107366658bdac554e862f771638b651a 100644 (file)
@@ -3144,6 +3144,16 @@ func Test_cmdline_complete_substitute_short()
   endfor
 endfunc
 
+" Test for :! shell command argument completion
+func Test_cmdline_complete_bang_cmd_argument()
+  set wildoptions=fuzzy
+  call feedkeys(":!vim test_cmdline.\<Tab>\<C-B>\"\<CR>", 'xt')
+  call assert_equal('"!vim test_cmdline.vim', @:)
+  set wildoptions&
+  call feedkeys(":!vim test_cmdline.\<Tab>\<C-B>\"\<CR>", 'xt')
+  call assert_equal('"!vim test_cmdline.vim', @:)
+endfunc
+
 func Check_completion()
   call assert_equal('let a', getcmdline())
   call assert_equal(6, getcmdpos())
index 7c584245a65036e21ed565e073471a777056e66b..74fb0e15e0cc366ad78fa7b2b14c3e62e6276e56 100644 (file)
@@ -735,6 +735,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    89,
 /**/
     88,
 /**/