aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-18 06:20:06 +0800
committerGitHub <noreply@github.com>2023-08-18 06:20:06 +0800
commit19d7fb8efeaeb84bc639282de1510b7e8962d49a (patch)
tree70e61646b7c7ea3d12aab1c81802db98fe0b1dfe /src
parent9f7e7455c01718c696e132513fd449235bd4f865 (diff)
downloadrneovim-19d7fb8efeaeb84bc639282de1510b7e8962d49a.tar.gz
rneovim-19d7fb8efeaeb84bc639282de1510b7e8962d49a.tar.bz2
rneovim-19d7fb8efeaeb84bc639282de1510b7e8962d49a.zip
vim-patch:9.0.1734: :runtime completion fails for multiple args (#24767)
Problem: :runtime completion fails for multiple args Solution: Make it work closes: vim/vim#12616 https://github.com/vim/vim/commit/be5cdd1d634c2dfc7e415499fb18f4d246a8721c
Diffstat (limited to 'src')
-rw-r--r--src/nvim/charset.c4
-rw-r--r--src/nvim/runtime.c9
2 files changed, 11 insertions, 2 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index c6efb4b3b4..4030d818c8 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -1376,7 +1376,7 @@ char *skiptowhite(const char *p)
/// @param p
///
/// @return Pointer to the next whitespace character.
-char *skiptowhite_esc(char *p)
+char *skiptowhite_esc(const char *p)
FUNC_ATTR_PURE
{
while (*p != ' ' && *p != '\t' && *p != NUL) {
@@ -1385,7 +1385,7 @@ char *skiptowhite_esc(char *p)
}
p++;
}
- return p;
+ return (char *)p;
}
/// Skip over text until '\n' or NUL.
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c
index 290b773371..89ffecd333 100644
--- a/src/nvim/runtime.c
+++ b/src/nvim/runtime.c
@@ -265,6 +265,15 @@ void set_context_in_runtime_cmd(expand_T *xp, const char *arg)
char *p = skiptowhite(arg);
runtime_expand_flags
= *p != NUL ? get_runtime_cmd_flags((char **)&arg, (size_t)(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 = (char *)arg;
}