summaryrefslogtreecommitdiffstats
path: root/src/cmdexpand.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-01-22 18:38:51 +0000
committerBram Moolenaar <Bram@vim.org>2023-01-22 18:38:51 +0000
commit3770f4c9cde7b5fcd10b6fa2e665cd0b69450fb2 (patch)
tree2537444947feb570db10bbf8472aae375fdc7d16 /src/cmdexpand.c
parentf3da4c8427b1b12d7aaffa307ec085ca97ea9ad9 (diff)
patch 9.0.1231: completion of :runtime does not handle {where} argumentv9.0.1231
Problem: Completion of :runtime does not handle {where} argument. Solution: Parse the {where} argument. (closes #11863)
Diffstat (limited to 'src/cmdexpand.c')
-rw-r--r--src/cmdexpand.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/cmdexpand.c b/src/cmdexpand.c
index 4fe9bd35bc..17f3878a0b 100644
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -2315,8 +2315,7 @@ set_context_by_cmdname(
break;
case CMD_runtime:
- xp->xp_context = EXPAND_RUNTIME;
- xp->xp_pattern = arg;
+ set_context_in_runtime_cmd(xp, arg);
break;
case CMD_compiler:
@@ -3028,9 +3027,7 @@ ExpandFromContext(
}
if (xp->xp_context == EXPAND_RUNTIME)
{
- char *directories[] = {"", NULL};
- return ExpandRTDir(pat, DIP_START + DIP_OPT + DIP_PRNEXT, numMatches,
- matches, directories);
+ return expand_runtime_cmd(pat, numMatches, matches);
}
if (xp->xp_context == EXPAND_COMPILER)
{
@@ -3612,13 +3609,15 @@ ExpandUserList(
/*
* Expand "file" for all comma-separated directories in "path".
* Adds the matches to "ga". Caller must init "ga".
+ * If "dirs" is TRUE only expand directory names.
*/
void
globpath(
char_u *path,
char_u *file,
garray_T *ga,
- int expand_options)
+ int expand_options,
+ int dirs)
{
expand_T xpc;
char_u *buf;
@@ -3631,7 +3630,7 @@ globpath(
return;
ExpandInit(&xpc);
- xpc.xp_context = EXPAND_FILES;
+ xpc.xp_context = dirs ? EXPAND_DIRECTORIES : EXPAND_FILES;
// Loop over all entries in {path}.
while (*path != NUL)
@@ -4038,6 +4037,11 @@ f_getcompletion(typval_T *argvars, typval_T *rettv)
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
}
# endif
+ if (xpc.xp_context == EXPAND_RUNTIME)
+ {
+ set_context_in_runtime_cmd(&xpc, xpc.xp_pattern);
+ xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
+ }
}
if (cmdline_fuzzy_completion_supported(&xpc))