forked from aniani/vim
patch 8.2.4478: crash when using fuzzy completion
Problem: Crash when using fuzzy completion. Solution: Temporary fix: put back regexp. (closes #9852, closes #9851)
This commit is contained in:
committed by
Bram Moolenaar
parent
29ab6ce9f3
commit
00333cb3b3
@@ -2496,6 +2496,8 @@ ExpandFromContext(
|
|||||||
int ret;
|
int ret;
|
||||||
int flags;
|
int flags;
|
||||||
char_u *tofree = NULL;
|
char_u *tofree = NULL;
|
||||||
|
int fuzzy = cmdline_fuzzy_complete(pat)
|
||||||
|
&& cmdline_fuzzy_completion_supported(xp);
|
||||||
|
|
||||||
flags = map_wildopts_to_ewflags(options);
|
flags = map_wildopts_to_ewflags(options);
|
||||||
|
|
||||||
@@ -2580,12 +2582,15 @@ ExpandFromContext(
|
|||||||
pat = tofree;
|
pat = tofree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!fuzzy)
|
||||||
|
{
|
||||||
regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0);
|
regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0);
|
||||||
if (regmatch.regprog == NULL)
|
if (regmatch.regprog == NULL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
|
||||||
// set ignore-case according to p_ic, p_scs and pat
|
// set ignore-case according to p_ic, p_scs and pat
|
||||||
regmatch.rm_ic = ignorecase(pat);
|
regmatch.rm_ic = ignorecase(pat);
|
||||||
|
}
|
||||||
|
|
||||||
if (xp->xp_context == EXPAND_SETTINGS
|
if (xp->xp_context == EXPAND_SETTINGS
|
||||||
|| xp->xp_context == EXPAND_BOOL_SETTINGS)
|
|| xp->xp_context == EXPAND_BOOL_SETTINGS)
|
||||||
@@ -2599,6 +2604,7 @@ ExpandFromContext(
|
|||||||
else
|
else
|
||||||
ret = ExpandOther(pat, xp, ®match, matches, numMatches);
|
ret = ExpandOther(pat, xp, ®match, matches, numMatches);
|
||||||
|
|
||||||
|
if (!fuzzy)
|
||||||
vim_regfree(regmatch.regprog);
|
vim_regfree(regmatch.regprog);
|
||||||
vim_free(tofree);
|
vim_free(tofree);
|
||||||
|
|
||||||
|
@@ -2659,6 +2659,10 @@ func Test_wildoptions_fuzzy()
|
|||||||
call assert_equal('"mapclear <buffer>', @:)
|
call assert_equal('"mapclear <buffer>', @:)
|
||||||
|
|
||||||
" map name fuzzy completion - NOT supported
|
" map name fuzzy completion - NOT supported
|
||||||
|
" test regex completion works
|
||||||
|
set wildoptions=fuzzy
|
||||||
|
call feedkeys(":cnoremap <ex\<Tab> <esc> \<Tab>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_equal("\"cnoremap <expr> <esc> \<Tab>", @:)
|
||||||
|
|
||||||
" menu name fuzzy completion
|
" menu name fuzzy completion
|
||||||
if has('gui_running')
|
if has('gui_running')
|
||||||
|
@@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4478,
|
||||||
/**/
|
/**/
|
||||||
4477,
|
4477,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user