aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-01-17 12:23:49 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-01-17 14:01:26 +0800
commitbdd14d03c7711e11c00cf81b417e869ecd10a3b0 (patch)
tree28c25a960b3daf5fab2843549a0baa5bad8323b1
parent4c127f107a0c930878b4a28dd96c41c505127b5d (diff)
downloadrneovim-bdd14d03c7711e11c00cf81b417e869ecd10a3b0.tar.gz
rneovim-bdd14d03c7711e11c00cf81b417e869ecd10a3b0.tar.bz2
rneovim-bdd14d03c7711e11c00cf81b417e869ecd10a3b0.zip
vim-patch:8.2.4477: crash when using fuzzy completion
Problem: Crash when using fuzzy completion. Solution: Temporary fix: put back regexp. (closes vim/vim#9851) https://github.com/vim/vim/commit/29ab6ce9f36660cffaad3c8789e71162e5db5d2f Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r--src/nvim/cmdexpand.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index b3f6047961..2f2545412b 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -2636,7 +2636,6 @@ static int ExpandFromContext(expand_T *xp, char *pat, char ***matches, int *numM
regmatch_T regmatch = { .rm_ic = false };
int ret;
int flags = map_wildopts_to_ewflags(options);
- const bool fuzzy = cmdline_fuzzy_complete(pat);
if (xp->xp_context == EXPAND_FILES
|| xp->xp_context == EXPAND_DIRECTORIES
@@ -2717,16 +2716,14 @@ static int ExpandFromContext(expand_T *xp, char *pat, char ***matches, int *numM
return nlua_expand_pat(xp, pat, numMatches, matches);
}
- if (!fuzzy) {
- regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0);
- if (regmatch.regprog == NULL) {
- return FAIL;
- }
-
- // set ignore-case according to p_ic, p_scs and pat
- regmatch.rm_ic = ignorecase(pat);
+ regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0);
+ if (regmatch.regprog == NULL) {
+ return FAIL;
}
+ // set ignore-case according to p_ic, p_scs and pat
+ regmatch.rm_ic = ignorecase(pat);
+
if (xp->xp_context == EXPAND_SETTINGS
|| xp->xp_context == EXPAND_BOOL_SETTINGS) {
ret = ExpandSettings(xp, &regmatch, pat, numMatches, matches);
@@ -2738,9 +2735,7 @@ static int ExpandFromContext(expand_T *xp, char *pat, char ***matches, int *numM
ret = ExpandOther(pat, xp, &regmatch, matches, numMatches);
}
- if (!fuzzy) {
- vim_regfree(regmatch.regprog);
- }
+ vim_regfree(regmatch.regprog);
xfree(tofree);
return ret;