1
0
forked from aniani/vim

patch 9.1.1157: command completion wrong for input()

Problem:  command completion wrong for input()
          (Cdrman Fu)
Solution: Set commandline completion context explicitly
          (Jim Zhou)

fixes #16723
closes: #16733

Signed-off-by: Jim Zhou <csd_189@163.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Jim Zhou
2025-02-27 19:29:50 +01:00
committed by Christian Brabandt
parent 85a50fe825
commit 3255af850e
3 changed files with 19 additions and 2 deletions

View File

@@ -228,8 +228,18 @@ nextwild(
int v; int v;
if (xp->xp_numfiles == -1) if (xp->xp_numfiles == -1)
{
#ifdef FEAT_EVAL
if (ccline->input_fn && ccline->xp_context == EXPAND_COMMANDS)
{
// Expand commands typed in input() function
set_cmd_context(xp, ccline->cmdbuff, ccline->cmdlen, ccline->cmdpos, FALSE);
}
else
#endif
{ {
set_expand_context(xp); set_expand_context(xp);
}
cmd_showtail = expand_showtail(xp); cmd_showtail = expand_showtail(xp);
} }

View File

@@ -2244,6 +2244,11 @@ func Test_input_func()
call assert_fails("call input('F:', '', 'invalid')", 'E180:') call assert_fails("call input('F:', '', 'invalid')", 'E180:')
call assert_fails("call input('F:', '', [])", 'E730:') call assert_fails("call input('F:', '', [])", 'E730:')
" 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)
endfunc endfunc
" Test for the inputdialog() function " Test for the inputdialog() function

View File

@@ -704,6 +704,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 */
/**/
1157,
/**/ /**/
1156, 1156,
/**/ /**/