autocomplete: lowercase searches clientside.

Lowercase searches clientside before sending them to the server. This is
to improve cache hit rates when users accidentally type in uppercase,
especially on mobile where the first letter often gets capitalized.
This commit is contained in:
evazion
2022-09-03 23:41:29 -05:00
parent 306f3d8f1a
commit 1968c9c69d

View File

@@ -97,7 +97,7 @@ Autocomplete.current_term = function($input) {
let query = $input.get(0).value;
let caret = $input.get(0).selectionStart;
let regexp = new RegExp(`^[-~(]*(${Autocomplete.tag_prefixes().join("|")})?`);
let match = query.substring(0, caret).match(/\S*$/)[0].replace(regexp, "");
let match = query.substring(0, caret).match(/\S*$/)[0].replace(regexp, "").toLowerCase();
return match;
};