From 04a64c6662c4f6bb3668a6a14d7b02b63782fefc Mon Sep 17 00:00:00 2001 From: Miodec Date: Tue, 11 Jun 2024 12:52:44 +0200 Subject: [PATCH] fix(typing test): line jumping too late --- .../src/ts/controllers/input-controller.ts | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/frontend/src/ts/controllers/input-controller.ts b/frontend/src/ts/controllers/input-controller.ts index bfe92d41f..ec6f6e60f 100644 --- a/frontend/src/ts/controllers/input-controller.ts +++ b/frontend/src/ts/controllers/input-controller.ts @@ -309,6 +309,29 @@ async function handleSpace(): Promise { TestInput.corrected.pushHistory(); + if (Config.keymapMode === "react") { + void KeymapEvent.flash(" ", true); + } + if ( + Config.mode === "words" || + Config.mode === "custom" || + Config.mode === "quote" || + Config.mode === "zen" + ) { + TimerProgress.update(); + } + if ( + Config.mode === "time" || + Config.mode === "words" || + Config.mode === "custom" || + Config.mode === "quote" + ) { + await TestLogic.addWord(); + } + TestUI.setCurrentWordElementIndex(TestUI.currentWordElementIndex + 1); + TestUI.updateActiveElement(); + void Caret.updatePosition(); + if ( !Config.showAllLines || Config.mode === "time" || @@ -345,29 +368,6 @@ async function handleSpace(): Promise { // //send a tab event using jquery // $("#wordsInput").trigger($.Event("keydown", { key: "Tab", code: "Tab" })); // } - - if (Config.keymapMode === "react") { - void KeymapEvent.flash(" ", true); - } - if ( - Config.mode === "words" || - Config.mode === "custom" || - Config.mode === "quote" || - Config.mode === "zen" - ) { - TimerProgress.update(); - } - if ( - Config.mode === "time" || - Config.mode === "words" || - Config.mode === "custom" || - Config.mode === "quote" - ) { - await TestLogic.addWord(); - } - TestUI.setCurrentWordElementIndex(TestUI.currentWordElementIndex + 1); - TestUI.updateActiveElement(); - void Caret.updatePosition(); } function isCharCorrect(char: string, charIndex: number): boolean {