Stop checking EXPAND_SPECIAL_FOR_CD if ..._AUTOSUGGEST is set

If EXPAND_SPECIAL_FOR_CD_AUTOSUGGEST is set, EXPAND_SPECIAL_FOR_CD
is necessarily also set; simplify things by only checking for the
latter.
This commit is contained in:
ridiculousfish 2018-01-08 22:34:14 -08:00
parent bf63e061c9
commit 46db0dd5eb

View file

@ -584,11 +584,12 @@ class wildcard_expander_t {
c->prepend_token_prefix(prefix);
}
// Hack. Implement EXPAND_SPECIAL_FOR_CD by descending the deepest unique hierarchy we
// Implement EXPAND_SPECIAL_FOR_CD_AUTOSUGGEST by descending the deepest unique
// hierarchy we
// can, and then appending any components to each new result.
// Only descend deepest unique for cd autosuggest and not for cd tab completion
// (issue #4402).
if (flags & EXPAND_SPECIAL_FOR_CD && flags & EXPAND_SPECIAL_FOR_CD_AUTOSUGGEST) {
if (flags & EXPAND_SPECIAL_FOR_CD_AUTOSUGGEST) {
wcstring unique_hierarchy = this->descend_unique_hierarchy(abs_path);
if (!unique_hierarchy.empty()) {
for (size_t i = before; i < after; i++) {