reordered handle char code again

This commit is contained in:
Miodec 2022-03-03 00:25:52 +01:00
parent e780914ed2
commit baaac84e13

View file

@ -466,22 +466,19 @@ function handleChar(char: string, charIndex: number): void {
TestInput.updateLastKeypress();
TestInput.pushKeypressWord(TestWords.words.currentIndex);
if (
Config.difficulty !== "master" &&
Config.stopOnError == "letter" &&
!thisCharCorrect
) {
return;
}
Replay.addReplayEvent(
thisCharCorrect ? "correctLetter" : "incorrectLetter",
char
);
if (!thisCharCorrect && Config.difficulty == "master") {
TestInput.input.pushHistory();
TestInput.corrected.pushHistory();
TestLogic.fail("difficulty");
return;
}
if (Config.stopOnError == "letter" && !thisCharCorrect) {
return;
}
//update the active word top, but only once
if (
TestInput.input.current.length === 1 &&
@ -501,6 +498,13 @@ function handleChar(char: string, charIndex: number): void {
TestInput.input.current = resultingWord;
}
if (!thisCharCorrect && Config.difficulty == "master") {
TestInput.input.pushHistory();
TestInput.corrected.pushHistory();
TestLogic.fail("difficulty");
return;
}
//keymap
if (Config.keymapMode === "react") {
Keymap.flashKey(char, thisCharCorrect);