patch 9.1.1226: "shellcmdline" completion doesn't work with input()
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 #948),
but since "shellcmdline" currently doesn't work at all, it makse sense
to at least make it work.
fixes: #16932
closes: #16934
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index c498ec0..28800f1 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -2245,10 +2245,20 @@
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