0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 9.0.1231: completion of :runtime does not handle {where} argument

Problem:    Completion of :runtime does not handle {where} argument.
Solution:   Parse the {where} argument. (closes #11863)
This commit is contained in:
zeertzjq
2023-01-22 18:38:51 +00:00
committed by Bram Moolenaar
parent f3da4c8427
commit 3770f4c9cd
11 changed files with 200 additions and 136 deletions

View File

@@ -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))