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>
diff --git a/src/cmdexpand.c b/src/cmdexpand.c
index c14eee2..9f24429 100644
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -229,8 +229,18 @@
 
     if (xp->xp_numfiles == -1)
     {
-	set_expand_context(xp);
-	cmd_showtail = expand_showtail(xp);
+#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);
+        }
+        cmd_showtail = expand_showtail(xp);
     }
 
     if (xp->xp_context == EXPAND_UNSUCCESSFUL)