From 4daa6ad8bfe47954a68605683658e961c761c785 Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 18 May 2021 20:23:55 +0100 Subject: [PATCH] fixed replay not working well with stop on error --- src/js/input-controller.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/js/input-controller.js b/src/js/input-controller.js index e79cb248f..1ce801213 100644 --- a/src/js/input-controller.js +++ b/src/js/input-controller.js @@ -234,7 +234,6 @@ function handleSpace(event, isEnter) { dontInsertSpace = true; if (currentWord == TestLogic.input.current || Config.mode == "zen") { //correct word or in zen mode - Replay.addReplayEvent("submitCorrectWord"); PaceCaret.handleSpace(true, currentWord); TestStats.incrementAccuracy(true); TestLogic.input.pushHistory(); @@ -250,9 +249,9 @@ function handleSpace(event, isEnter) { if (Funbox.active !== "nospace") { Sound.playClick(Config.playSoundOnClick); } + Replay.addReplayEvent("submitCorrectWord"); } else { //incorrect word - Replay.addReplayEvent("submitErrorWord"); PaceCaret.handleSpace(false, currentWord); if (Funbox.active !== "nospace") { if (!Config.playSoundOnError || Config.blindMode) { @@ -309,6 +308,7 @@ function handleSpace(event, isEnter) { TestLogic.finish(); return; } + Replay.addReplayEvent("submitErrorWord"); } TestLogic.corrected.pushHistory(); @@ -572,7 +572,6 @@ function handleAlpha(event) { } if (!thisCharCorrect) { - Replay.addReplayEvent("incorrectLetter", event.key); TestStats.incrementAccuracy(false); TestStats.incrementKeypressErrors(); // currentError.count++; @@ -580,7 +579,6 @@ function handleAlpha(event) { thisCharCorrect = false; TestStats.pushMissedWord(TestLogic.words.getCurrent()); } else { - Replay.addReplayEvent("correctLetter", event.key); TestStats.incrementAccuracy(true); thisCharCorrect = true; if (Config.mode == "zen") { @@ -632,6 +630,11 @@ function handleAlpha(event) { return; } + Replay.addReplayEvent( + thisCharCorrect ? "correctLetter" : "incorrectLetter", + event.key + ); + //update the active word top, but only once if ( TestLogic.input.current.length === 1 &&