typeahead: Treat query and source string in the same way before matching.

Like the source string, now the query too is converted into lower case
and has diacritics removed, before trying to determine a match.
This commit is contained in:
N-Shar-ma 2023-03-10 21:57:35 +05:30 committed by Tim Abbott
parent 0cc40605b0
commit 5d83e53ca5
1 changed files with 3 additions and 0 deletions

View File

@ -62,6 +62,9 @@ export function query_matches_string(
source_str = source_str.toLowerCase();
source_str = remove_diacritics(source_str);
query = query.toLowerCase();
query = remove_diacritics(query);
if (!query.includes(split_char)) {
// If query is a single token (doesn't contain a separator),
// the match can be anywhere in the string.