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>
diff --git a/src/scriptfile.c b/src/scriptfile.c
index 37d57e5..2aca346 100644
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -289,6 +289,15 @@
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;
}