diff options
author | 2013-09-14 23:59:53 -0700 | |
---|---|---|
committer | 2013-09-15 00:00:35 -0700 | |
commit | 95d5e55df25962282b3a9522400db0f4f227b413 (patch) | |
tree | 64d6aef4b72934242307b4954fdb9a250142b872 /complete.cpp | |
parent | daf3469ce4eab8f772b03944dcf788c4608d0ca2 (diff) |
Don't do fuzzy matching for file completions for arguments beginning
with a dash, as suggested in #568
Diffstat (limited to 'complete.cpp')
-rw-r--r-- | complete.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/complete.cpp b/complete.cpp index ad2bbb14..7b0b4173 100644 --- a/complete.cpp +++ b/complete.cpp @@ -1616,7 +1616,7 @@ void completer_t::complete_param_expand(const wcstring &sstr, bool do_file) 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) 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) 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, this->completions, - flags | this->expand_flags()) == EXPAND_ERROR) + flags ) == EXPAND_ERROR) { debug(3, L"Error while expanding string '%ls'", comp_str); } |