diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-03-20 07:21:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-20 07:21:17 +0800 |
commit | 175c09bd660d0cea62288e74cea925a9b15bee55 (patch) | |
tree | 5144746501255be6b06e1355fd0d94471db6066e | |
parent | 51853b82bc95a7b62875d07a0ade6cfa0bdd0b5b (diff) | |
download | rneovim-175c09bd660d0cea62288e74cea925a9b15bee55.tar.gz rneovim-175c09bd660d0cea62288e74cea925a9b15bee55.tar.bz2 rneovim-175c09bd660d0cea62288e74cea925a9b15bee55.zip |
vim-patch:9.1.1226: "shellcmdline" completion doesn't work with input() (#32998)
Problem: "shellcmdline" completion doesn't work with input().
Solution: Use set_context_for_wildcard_arg(). Fix indent in nextwild()
(zeertzjq).
There are some other inconsistencies for input() completion (ref vim/vim#948),
but since "shellcmdline" currently doesn't work at all, it makse sense
to at least make it work.
fixes: vim/vim#16932
closes: vim/vim#16934
https://github.com/vim/vim/commit/7a5115ce50c622caf91503f9d7fe09c3749b928b
-rw-r--r-- | src/nvim/cmdexpand.c | 4 | ||||
-rw-r--r-- | test/old/testdir/test_functions.vim | 12 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index fcfeda5482..28cc70ff5a 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -2407,6 +2407,10 @@ void set_cmd_context(expand_T *xp, char *str, int len, int col, int use_ccline) xp->xp_context = ccline->xp_context; xp->xp_pattern = ccline->cmdbuff; xp->xp_arg = ccline->xp_arg; + if (xp->xp_context == EXPAND_SHELLCMDLINE) { + int context = xp->xp_context; + set_context_for_wildcard_arg(NULL, xp->xp_pattern, false, xp, &context); + } } else { while (nextcomm != NULL) { nextcomm = set_one_cmd_context(xp, nextcomm); diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 7c6c32f3c4..4ddb3db6fa 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -2072,10 +2072,20 @@ func Test_input_func() call assert_fails("call input('F:', '', 'invalid')", 'E180:') call assert_fails("call input('F:', '', [])", 'E730:') - " Test for using 'command' as the completion function + " Test for using "command" as the completion function call feedkeys(":let c = input('Command? ', '', 'command')\<CR>" \ .. "echo bufnam\<C-A>\<CR>", 'xt') call assert_equal('echo bufname(', c) + + " Test for using "shellcmdline" as the completion function + call feedkeys(":let c = input('Shell? ', '', 'shellcmdline')\<CR>" + \ .. "vim test_functions.\<C-A>\<CR>", 'xt') + call assert_equal('vim test_functions.vim', c) + if executable('whoami') + call feedkeys(":let c = input('Shell? ', '', 'shellcmdline')\<CR>" + \ .. "whoam\<C-A>\<CR>", 'xt') + call assert_match('\<whoami\>', c) + endif endfunc " Test for the inputdialog() function |