1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-27 21:05:53 +00:00

Merge pull request #1375 from Tester798/fix-emote-autocomplete

Fix autocomplete not showing all emotes
This commit is contained in:
Mike 2023-08-19 16:49:18 -04:00 committed by GitHub
commit 7455ec6a2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,9 +19,10 @@ const localeCaseInsensitive = Intl.Collator(undefined, {sensitivity: 'accent'});
// Describes how an emote matches against a given input
// Higher values represent a more exact match
const NO_MATCH = 0;
const NON_PREFIX_MATCH = 1;
const CASE_INSENSITIVE_PREFIX_MATCH = 2;
const EXACT_PREFIX_MATCH = 3;
const CASE_INSENSITIVE_NON_PREFIX_MATCH = 1;
const NON_PREFIX_MATCH = 2;
const CASE_INSENSITIVE_PREFIX_MATCH = 3;
const EXACT_PREFIX_MATCH = 4;
function getNodeText(node) {
if ( ! node )
@ -888,6 +889,9 @@ export default class Input extends Module {
if (idx !== -1 && emote_lower.slice(idx + 1).startsWith(term_lower.slice(1)))
return NON_PREFIX_MATCH;
if (emote_lower.includes(term_lower))
return CASE_INSENSITIVE_NON_PREFIX_MATCH;
return NO_MATCH;
}