diff --git a/src/common.cpp b/src/common.cpp index 118b20b92..10e2343f8 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -1848,7 +1848,7 @@ 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 && + } else if (limit_type >= fuzzy_match_substring_case_insensitive && (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; diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp index 91d9e0554..a46bd37e9 100644 --- a/src/fish_tests.cpp +++ b/src/fish_tests.cpp @@ -1723,6 +1723,8 @@ static void test_fuzzy_match() { err(L"test_fuzzy_match failed on line %ld", __LINE__); if (string_fuzzy_match_string(L"LPH", L"ALPHA!").type != fuzzy_match_substring) err(L"test_fuzzy_match failed on line %ld", __LINE__); + if (string_fuzzy_match_string(L"lPh", L"ALPHA!").type != fuzzy_match_substring_case_insensitive) + err(L"test_fuzzy_match failed on line %ld", __LINE__); if (string_fuzzy_match_string(L"AA", L"ALPHA!").type != fuzzy_match_subsequence_insertions_only) err(L"test_fuzzy_match failed on line %ld", __LINE__); if (string_fuzzy_match_string(L"BB", L"ALPHA!").type != fuzzy_match_none)