diff src/scriptfile.c @ 32844:5d3c0f914f26 v9.0.1734

patch 9.0.1734: :runtime completion fails for multiple args Commit: https://github.com/vim/vim/commit/be5cdd1d634c2dfc7e415499fb18f4d246a8721c Author: zeertzjq <zeertzjq@outlook.com> Date: Thu Aug 17 23:48:58 2023 +0200 patch 9.0.1734: :runtime completion fails for multiple args Problem: :runtime completion fails for multiple args Solution: Make it work closes: #12616 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author Christian Brabandt <cb@256bit.org>
date Fri, 18 Aug 2023 00:00:05 +0200
parents 61389a392fe8
children cbb5a593c92a
line wrap: on
line diff
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -289,6 +289,15 @@ set_context_in_runtime_cmd(expand_T *xp,
     char_u  *p = skiptowhite(arg);
     runtime_expand_flags
 	= *p != NUL ? get_runtime_cmd_flags(&arg, p - arg) : 0;
+    // Skip to the last argument.
+    while (*(p = skiptowhite_esc(arg)) != NUL)
+    {
+	if (runtime_expand_flags == 0)
+	    // When there are multiple arguments and [where] is not specified,
+	    // use an unrelated non-zero flag to avoid expanding [where].
+	    runtime_expand_flags = DIP_ALL;
+	arg = skipwhite(p);
+    }
     xp->xp_context = EXPAND_RUNTIME;
     xp->xp_pattern = arg;
 }