mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
Don't do fuzzy matching for file completions for arguments beginning
with a dash, as suggested in #568
This commit is contained in:
parent
daf3469ce4
commit
95d5e55df2
1 changed files with 6 additions and 2 deletions
|
@ -1616,7 +1616,7 @@ void completer_t::complete_param_expand(const wcstring &sstr, bool do_file)
|
||||||
comp_str = str;
|
comp_str = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
expand_flags_t flags = EXPAND_SKIP_CMDSUBST | ACCEPT_INCOMPLETE;
|
expand_flags_t flags = EXPAND_SKIP_CMDSUBST | ACCEPT_INCOMPLETE | this->expand_flags();
|
||||||
|
|
||||||
if (! do_file)
|
if (! do_file)
|
||||||
flags |= EXPAND_SKIP_WILDCARDS;
|
flags |= EXPAND_SKIP_WILDCARDS;
|
||||||
|
@ -1625,9 +1625,13 @@ void completer_t::complete_param_expand(const wcstring &sstr, bool do_file)
|
||||||
if (this->type() == COMPLETE_AUTOSUGGEST || do_file)
|
if (this->type() == COMPLETE_AUTOSUGGEST || do_file)
|
||||||
flags |= EXPAND_NO_DESCRIPTIONS;
|
flags |= EXPAND_NO_DESCRIPTIONS;
|
||||||
|
|
||||||
|
/* Don't do fuzzy matching for files if the string begins with a dash (#568). We could consider relaxing this if there was a preceding double-dash argument */
|
||||||
|
if (string_prefixes_string(L"-", sstr))
|
||||||
|
flags &= ~EXPAND_FUZZY_MATCH;
|
||||||
|
|
||||||
if (expand_string(comp_str,
|
if (expand_string(comp_str,
|
||||||
this->completions,
|
this->completions,
|
||||||
flags | this->expand_flags()) == EXPAND_ERROR)
|
flags ) == EXPAND_ERROR)
|
||||||
{
|
{
|
||||||
debug(3, L"Error while expanding string '%ls'", comp_str);
|
debug(3, L"Error while expanding string '%ls'", comp_str);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue