From a042c4e93dbc689bb9b19d14d66f9ca95fbdd754 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Wed, 26 Apr 2023 17:22:47 +0100 Subject: [PATCH] Help: Perform a fuzzy match on the page title when searching This allows for slight misspellings to still return a result. --- Userland/Applications/Help/ManualModel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Applications/Help/ManualModel.cpp b/Userland/Applications/Help/ManualModel.cpp index 770af30efd7..bbee48ec029 100644 --- a/Userland/Applications/Help/ManualModel.cpp +++ b/Userland/Applications/Help/ManualModel.cpp @@ -5,6 +5,7 @@ */ #include "ManualModel.h" +#include #include #include #include @@ -213,7 +214,8 @@ TriState ManualModel::data_matches(const GUI::ModelIndex& index, const GUI::Vari if (!name.has_value()) return TriState::False; - if (name.value().bytes_as_string_view().contains(term.as_string(), CaseSensitivity::CaseInsensitive)) + auto match_result = fuzzy_match(term.as_string(), name.value()); + if (match_result.score > 0) return TriState::True; auto path = page_path(index);