mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-10 05:35:05 +08:00
reordered handle char code again
This commit is contained in:
parent
e780914ed2
commit
baaac84e13
1 changed files with 15 additions and 11 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue