diff --git a/Userland/Applications/Assistant/Providers.cpp b/Userland/Applications/Assistant/Providers.cpp index b8c6e45e56e..c0c66a46873 100644 --- a/Userland/Applications/Assistant/Providers.cpp +++ b/Userland/Applications/Assistant/Providers.cpp @@ -81,12 +81,18 @@ void AppProvider::query(DeprecatedString const& query, Functionname()); - if (!match_result.matched) - continue; + auto score = 0; + if (app_name.equals_ignoring_ascii_case(app_file->name())) + score = NumericLimits::max(); + else { + auto match_result = fuzzy_match(app_name, app_file->name()); + if (!match_result.matched) + continue; + score = match_result.score; + } auto icon = GUI::FileIconProvider::icon_for_executable(app_file->executable()); - results.append(make_ref_counted(icon.bitmap_for_size(16), app_file->name(), String(), app_file, arguments, match_result.score)); + results.append(make_ref_counted(icon.bitmap_for_size(16), app_file->name(), String(), app_file, arguments, score)); }; on_complete(move(results)); @@ -147,17 +153,24 @@ void FileProvider::query(DeprecatedString const& query, Function::max(); + } else { + auto match_result = fuzzy_match(query, path); + if (!match_result.matched) + continue; + if (match_result.score < 0) + continue; - if (sorted_results.size() < MAX_SEARCH_RESULTS || match_result.score > sorted_results.peek_min_key()) { + score = match_result.score; + } + + if (sorted_results.size() < MAX_SEARCH_RESULTS || score > sorted_results.peek_min_key()) { if (sorted_results.size() == MAX_SEARCH_RESULTS) sorted_results.pop_min(); - sorted_results.insert(match_result.score, path); + sorted_results.insert(score, path); } }