Skip to content

Commit

Permalink
impr(typing): add reminder that opposite shift mode is on if incorrec…
Browse files Browse the repository at this point in the history
…t shift was used too many times

Closes #4626
  • Loading branch information
Miodec committed Sep 13, 2023
1 parent 6d7c3fe commit 5dfa95e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion frontend/src/ts/controllers/input-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ let dontInsertSpace = false;
let correctShiftUsed = true;
let isKoCompiling = false;
let isBackspace: boolean;
let incorrectShiftsInARow = 0;

const wordsInput = document.getElementById("wordsInput") as HTMLInputElement;
const koInputVisual = document.getElementById("koInputVisual") as HTMLElement;
Expand Down Expand Up @@ -561,7 +562,20 @@ function handleChar(
KeymapEvent.flash(char, thisCharCorrect);
}

if (!correctShiftUsed && Config.difficulty !== "master") return;
if (Config.difficulty !== "master") {
if (!correctShiftUsed) {
incorrectShiftsInARow++;
if (incorrectShiftsInARow >= 5) {
Notifications.add("Reminder: Opposite shift mode is on.", 0, {
important: true,
});
}
return;
} else {
incorrectShiftsInARow = 0;
console.log("correct shift used");
}
}

//update current corrected version. if its empty then add the current char. if its not then replace the last character with the currently pressed one / add it
if (TestInput.corrected.current === "") {
Expand Down

0 comments on commit 5dfa95e

Please sign in to comment.