int ret;
int flags;
char_u *tofree = NULL;
+ int fuzzy = cmdline_fuzzy_complete(pat)
+ && cmdline_fuzzy_completion_supported(xp);
flags = map_wildopts_to_ewflags(options);
pat = tofree;
}
- regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0);
- if (regmatch.regprog == NULL)
- return FAIL;
+ 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);
+ // 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)
else
ret = ExpandOther(pat, xp, ®match, matches, numMatches);
- vim_regfree(regmatch.regprog);
+ if (!fuzzy)
+ vim_regfree(regmatch.regprog);
vim_free(tofree);
return ret;
call assert_equal('"mapclear <buffer>', @:)
" 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
if has('gui_running')