aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-06-16 07:02:21 +0800
committerGitHub <noreply@github.com>2023-06-16 07:02:21 +0800
commitddba917efee26229d77f86d14a9f62dcfdc822b8 (patch)
tree700489889734974e098752a003e229ad41145853 /src
parent1f8fb7c00048bc217bb9a2bf29c58630d1810d6e (diff)
downloadrneovim-ddba917efee26229d77f86d14a9f62dcfdc822b8.tar.gz
rneovim-ddba917efee26229d77f86d14a9f62dcfdc822b8.tar.bz2
rneovim-ddba917efee26229d77f86d14a9f62dcfdc822b8.zip
vim-patch:9.0.1636: expanding a pattern interferes with cmdline completion (#24034)
Problem: Expanding a pattern interferes with command line completion. Solution: Set the file index only when appropriate. (closes vim/vim#12519) https://github.com/vim/vim/commit/094dd152fe1d47878ec6c0b3f54b03ffde7f4a2d
Diffstat (limited to 'src')
-rw-r--r--src/nvim/cmdexpand.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index bf0944a81d..b2835cae0f 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -841,7 +841,7 @@ static char *find_longest_match(expand_T *xp, int options)
char *ExpandOne(expand_T *xp, char *str, char *orig, int options, int mode)
{
char *ss = NULL;
- static int findex;
+ static int findex; // TODO(vim): Move into expand_T
static char *orig_save = NULL; // kept value of orig
int orig_saved = false;
@@ -871,7 +871,10 @@ char *ExpandOne(expand_T *xp, char *str, char *orig, int options, int mode)
cmdline_pum_remove();
}
}
- findex = 0;
+ // TODO(vim): Remove condition if "findex" is part of expand_T ?
+ if (mode != WILD_EXPAND_FREE && mode != WILD_ALL && mode != WILD_ALL_KEEP) {
+ findex = 0;
+ }
if (mode == WILD_FREE) { // only release file name
return NULL;