From ce25a81208354750e6e7eec6e363d158a54bc2d5 Mon Sep 17 00:00:00 2001 From: OMGparticles Date: Mon, 3 Apr 2023 17:55:08 -0700 Subject: [PATCH] - Emotes now appear in the auto complete list if the given sequence of characters exist anywhere in the emote name. --- src/sites/twitch-twilight/modules/chat/input.jsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/sites/twitch-twilight/modules/chat/input.jsx b/src/sites/twitch-twilight/modules/chat/input.jsx index ebeb2925..71e9455c 100644 --- a/src/sites/twitch-twilight/modules/chat/input.jsx +++ b/src/sites/twitch-twilight/modules/chat/input.jsx @@ -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 SUBSTRING_MATCH = 1; +const NON_PREFIX_MATCH = 2; +const CASE_INSENSITIVE_PREFIX_MATCH = 3; +const EXACT_PREFIX_MATCH = 4; function getNodeText(node) { if ( ! node ) @@ -829,6 +830,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 SUBSTRING_MATCH; + return NO_MATCH; }