aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/cmdexpand.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-01-26 09:58:27 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-01-26 11:55:34 +0800
commit6320c91c50e4c0ee5c366241f9a413c4edbfdad8 (patch)
treefe86bb030a80ab6459b1903229693a113d5d1088 /src/nvim/cmdexpand.c
parent6644786db078e019426f90cf85da50e3fa1b6a67 (diff)
downloadrneovim-6320c91c50e4c0ee5c366241f9a413c4edbfdad8.tar.gz
rneovim-6320c91c50e4c0ee5c366241f9a413c4edbfdad8.tar.bz2
rneovim-6320c91c50e4c0ee5c366241f9a413c4edbfdad8.zip
vim-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 vim/vim#11863) https://github.com/vim/vim/commit/3770f4c9cde7b5fcd10b6fa2e665cd0b69450fb2
Diffstat (limited to 'src/nvim/cmdexpand.c')
-rw-r--r--src/nvim/cmdexpand.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index 3e06814d6a..21ea8c1ffc 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -2075,8 +2075,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, expa
break;
case CMD_runtime:
- xp->xp_context = EXPAND_RUNTIME;
- xp->xp_pattern = (char *)arg;
+ set_context_in_runtime_cmd(xp, arg);
break;
case CMD_compiler:
@@ -2720,9 +2719,7 @@ static int ExpandFromContext(expand_T *xp, char *pat, char ***matches, int *numM
return ExpandRTDir(pat, DIP_START + DIP_OPT, numMatches, matches, directories);
}
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) {
char *directories[] = { "compiler", NULL };
@@ -3213,11 +3210,12 @@ static int ExpandUserLua(expand_T *xp, int *num_file, char ***file)
/// Expand `file` for all comma-separated directories in `path`.
/// Adds matches to `ga`.
-void globpath(char *path, char *file, garray_T *ga, int expand_options)
+/// If "dirs" is true only expand directory names.
+void globpath(char *path, char *file, garray_T *ga, int expand_options, bool dirs)
{
expand_T xpc;
ExpandInit(&xpc);
- xpc.xp_context = EXPAND_FILES;
+ xpc.xp_context = dirs ? EXPAND_DIRECTORIES : EXPAND_FILES;
char *buf = xmalloc(MAXPATHL);
@@ -3536,11 +3534,14 @@ void f_getcompletion(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
set_context_in_menu_cmd(&xpc, "menu", xpc.xp_pattern, false);
xpc.xp_pattern_len = strlen(xpc.xp_pattern);
}
-
if (xpc.xp_context == EXPAND_SIGN) {
set_context_in_sign_cmd(&xpc, xpc.xp_pattern);
xpc.xp_pattern_len = strlen(xpc.xp_pattern);
}
+ if (xpc.xp_context == EXPAND_RUNTIME) {
+ set_context_in_runtime_cmd(&xpc, xpc.xp_pattern);
+ xpc.xp_pattern_len = strlen(xpc.xp_pattern);
+ }
theend:
if (cmdline_fuzzy_completion_supported(&xpc)) {