aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/wildcard.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-10-03 15:44:57 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-10-03 15:44:57 -0700
commitaeaacedf75a99b06a93d8fe873ed7a795ed4f3dd (patch)
treeeab60340f13ace98b5dfe9745b87d56edb2fba60 /src/wildcard.cpp
parentbec6d5c174f103085a5c5b53fcbe3db5a9de1193 (diff)
Don't do intermediate fuzzy directory matching with $PATH
When expanding an executable with $PATH, don't attempt to interpret the directories in PATH as fuzzy matching. Fixes #2413.
Diffstat (limited to 'src/wildcard.cpp')
-rw-r--r--src/wildcard.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/wildcard.cpp b/src/wildcard.cpp
index 45d3cb6a..54c90e98 100644
--- a/src/wildcard.cpp
+++ b/src/wildcard.cpp
@@ -1002,9 +1002,11 @@ void wildcard_expander_t::expand(const wcstring &base_dir, const wchar_t *wc)
/* This just trumps everything */
size_t before = this->resolved_completions->size();
this->expand(base_dir + wc_segment + L'/', wc_remainder);
- if ((this->flags & EXPAND_FUZZY_MATCH) && this->resolved_completions->size() == before)
+
+ /* Maybe try a fuzzy match (#94) if nothing was found with the literal match. Respect EXPAND_NO_DIRECTORY_ABBREVIATIONS (#2413). */
+ bool allow_fuzzy = (this->flags & (EXPAND_FUZZY_MATCH | EXPAND_NO_FUZZY_DIRECTORIES)) == EXPAND_FUZZY_MATCH;
+ if (allow_fuzzy && this->resolved_completions->size() == before)
{
- /* Nothing was found with the literal match. Try a fuzzy match (#94). */
assert(this->flags & EXPAND_FOR_COMPLETIONS);
DIR *base_dir_fd = open_dir(base_dir);
if (base_dir_fd != NULL)