diff --git a/src/common.cpp b/src/common.cpp index 2befc3f6f..a9037ca8f 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -1835,6 +1835,13 @@ string_fuzzy_match_t string_fuzzy_match_string(const wcstring &string, assert(match_against.size() >= string.size()); result.match_distance_first = match_against.size() - string.size(); result.match_distance_second = location; // prefer earlier matches + } else if (limit_type >= fuzzy_match_substring && + (location = ifind(match_against, string)) != wcstring::npos) { + // A case-insensitive version of the string is in the match against. + result.type = fuzzy_match_substring_case_insensitive; + assert(match_against.size() >= string.size()); + result.match_distance_first = match_against.size() - string.size(); + result.match_distance_second = location; // prefer earlier matches } else if (limit_type >= fuzzy_match_subsequence_insertions_only && subsequence_in_string(string, match_against)) { result.type = fuzzy_match_subsequence_insertions_only; diff --git a/src/common.h b/src/common.h index f8a5fd0ac..7f61a611d 100644 --- a/src/common.h +++ b/src/common.h @@ -399,6 +399,9 @@ enum fuzzy_match_type_t { // We match a substring of the string: OOBA matches FOOBAR. fuzzy_match_substring, + // We match a substring of the string: ooBA matches FOOBAR. + fuzzy_match_substring_case_insensitive, + // A subsequence match with insertions only: FBR matches FOOBAR. fuzzy_match_subsequence_insertions_only,