mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-12 02:17:21 +08:00
fixed enter inserting a ghost character when typed incorrectly
This commit is contained in:
parent
874e5cbebe
commit
65b3c1c1e4
1 changed files with 11 additions and 6 deletions
|
@ -440,10 +440,6 @@ function handleChar(char, charIndex) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (TestLogic.input.current === "") {
|
||||
TestStats.setBurstStart(performance.now());
|
||||
}
|
||||
|
||||
Focus.set(true);
|
||||
Caret.stopAnimation();
|
||||
|
||||
|
@ -453,6 +449,15 @@ function handleChar(char, charIndex) {
|
|||
char = TestLogic.words.getCurrent().charAt(charIndex);
|
||||
}
|
||||
|
||||
if (!thisCharCorrect && char === "\n") {
|
||||
if (TestLogic.input.current === "") return;
|
||||
char = " ";
|
||||
}
|
||||
|
||||
if (TestLogic.input.current === "") {
|
||||
TestStats.setBurstStart(performance.now());
|
||||
}
|
||||
|
||||
const resultingWord =
|
||||
TestLogic.input.current.substring(0, charIndex) +
|
||||
char +
|
||||
|
@ -577,7 +582,6 @@ function handleChar(char, charIndex) {
|
|||
|
||||
let activeWordTopBeforeJump = document.querySelector("#words .word.active")
|
||||
.offsetTop;
|
||||
TestUI.updateWordElement();
|
||||
|
||||
if (!Config.hideExtraLetters) {
|
||||
let newActiveTop = document.querySelector("#words .word.active").offsetTop;
|
||||
|
@ -596,11 +600,12 @@ function handleChar(char, charIndex) {
|
|||
if (!Config.showAllLines) TestUI.lineJump(currentTop);
|
||||
} else {
|
||||
TestLogic.input.current = TestLogic.input.current.slice(0, -1);
|
||||
TestUI.updateWordElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TestUI.updateWordElement();
|
||||
|
||||
//simulate space press in nospace funbox
|
||||
if (
|
||||
(Config.funbox === "nospace" &&
|
||||
|
|
Loading…
Reference in a new issue