From 9d9e879ebea4ede09425fecad970fda0a2515796 Mon Sep 17 00:00:00 2001 From: Miodec Date: Wed, 2 Mar 2022 23:16:22 +0100 Subject: [PATCH] updating input before failing --- .../scripts/controllers/input-controller.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/frontend/src/scripts/controllers/input-controller.ts b/frontend/src/scripts/controllers/input-controller.ts index 4169d69a7..f8275aa59 100644 --- a/frontend/src/scripts/controllers/input-controller.ts +++ b/frontend/src/scripts/controllers/input-controller.ts @@ -466,6 +466,15 @@ function handleChar(char: string, charIndex: number): void { TestInput.updateLastKeypress(); TestInput.pushKeypressWord(TestWords.words.currentIndex); + //max length of the input is 20 unless in zen mode then its 30 + if ( + (Config.mode === "zen" && charIndex < 30) || + (Config.mode !== "zen" && + charIndex < TestWords.words.getCurrent().length + 20) + ) { + TestInput.input.current = resultingWord; + } + if (!thisCharCorrect && Config.difficulty == "master") { TestInput.input.pushHistory(); TestInput.corrected.pushHistory(); @@ -492,15 +501,6 @@ function handleChar(char: string, charIndex: number): void { ); } - //max length of the input is 20 unless in zen mode then its 30 - if ( - (Config.mode === "zen" && charIndex < 30) || - (Config.mode !== "zen" && - charIndex < TestWords.words.getCurrent().length + 20) - ) { - TestInput.input.current = resultingWord; - } - //keymap if (Config.keymapMode === "react") { Keymap.flashKey(char, thisCharCorrect);