From e1cc4716b80cefbfd4a20c34dc2c0ef5a5e5e947 Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 11 Jul 2022 22:20:28 +0200 Subject: [PATCH] reverted part of #3318 to fix #3336 and #3335 --- frontend/src/ts/test/test-ui.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/ts/test/test-ui.ts b/frontend/src/ts/test/test-ui.ts index a5eda939e..be15a344e 100644 --- a/frontend/src/ts/test/test-ui.ts +++ b/frontend/src/ts/test/test-ui.ts @@ -372,7 +372,21 @@ export function updateWordElement(showError = !Config.blindMode): void { } } } else { - let wordHighlightClassString = "incorrect"; + let correctSoFar = false; + + // slice earlier if input has trailing compose characters + const inputWithoutComposeLength = Misc.trailingComposeChars.test(input) + ? input.search(Misc.trailingComposeChars) + : input.length; + if ( + input.search(Misc.trailingComposeChars) < currentWord.length && + currentWord.slice(0, inputWithoutComposeLength) === + input.slice(0, inputWithoutComposeLength) + ) { + correctSoFar = true; + } + + let wordHighlightClassString = correctSoFar ? "correct" : "incorrect"; if (Config.blindMode) { wordHighlightClassString = "correct"; }