0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 9.0.0089: fuzzy argument completion doesn't work for shell commands

Problem:    Fuzzy argument completion doesn't work for shell commands.
Solution:   Check for cmdidx not being CMD_bang. (Yegappan Lakshmanan,
            closes #10769)
This commit is contained in:
Yegappan Lakshmanan
2022-07-26 22:01:36 +01:00
committed by Bram Moolenaar
parent 30e212dac1
commit 7db3a8e329
3 changed files with 16 additions and 2 deletions

View 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); eap->cmdidx = excmd_get_cmdidx(cmd, len);
// User defined commands support alphanumeric characters. // User defined commands support alphanumeric characters.
// Also when doing fuzzy expansion, support alphanumeric characters. // Also when doing fuzzy expansion for non-shell commands, support
if ((cmd[0] >= 'A' && cmd[0] <= 'Z') || (fuzzy && *p != NUL)) // alphanumeric characters.
if ((cmd[0] >= 'A' && cmd[0] <= 'Z')
|| (fuzzy && eap->cmdidx != CMD_bang && *p != NUL))
while (ASCII_ISALNUM(*p) || *p == '*') // Allow * wild card while (ASCII_ISALNUM(*p) || *p == '*') // Allow * wild card
++p; ++p;
} }

View File

@@ -3144,6 +3144,16 @@ func Test_cmdline_complete_substitute_short()
endfor endfor
endfunc 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() func Check_completion()
call assert_equal('let a', getcmdline()) call assert_equal('let a', getcmdline())
call assert_equal(6, getcmdpos()) call assert_equal(6, getcmdpos())

View File

@@ -735,6 +735,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
89,
/**/ /**/
88, 88,
/**/ /**/