mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-09-08 15:47:37 +08:00
fix: make sure to consider activeWordElementOffset when backspacing
!nuf
This commit is contained in:
parent
d9173a5b86
commit
bda99ca91f
1 changed files with 6 additions and 6 deletions
|
@ -118,10 +118,10 @@ function updateUI(): void {
|
|||
function backspaceToPrevious(): void {
|
||||
if (!TestState.isActive) return;
|
||||
|
||||
if (
|
||||
TestInput.input.getHistory().length === 0 ||
|
||||
TestState.activeWordIndex - TestUI.activeWordElementOffset === 0
|
||||
) {
|
||||
const wordElementIndex =
|
||||
TestState.activeWordIndex - TestUI.activeWordElementOffset;
|
||||
|
||||
if (TestInput.input.getHistory().length === 0 || wordElementIndex === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ function backspaceToPrevious(): void {
|
|||
(TestInput.input.getHistory(TestState.activeWordIndex - 1) ==
|
||||
TestWords.words.get(TestState.activeWordIndex - 1) &&
|
||||
!Config.freedomMode) ||
|
||||
wordElements[TestState.activeWordIndex - 1]?.classList.contains("hidden")
|
||||
wordElements[wordElementIndex - 1]?.classList.contains("hidden")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ function backspaceToPrevious(): void {
|
|||
}
|
||||
|
||||
const incorrectLetterBackspaced =
|
||||
wordElements[TestState.activeWordIndex]?.children[0]?.classList.contains(
|
||||
wordElements[wordElementIndex]?.children[0]?.classList.contains(
|
||||
"incorrect"
|
||||
);
|
||||
if (Config.stopOnError === "letter" && incorrectLetterBackspaced) {
|
||||
|
|
Loading…
Add table
Reference in a new issue