impr(test): stop on letter now supports indicate typos

The typos will now be correctly shown to the right of the caret
This commit is contained in:
Miodec 2023-08-13 01:21:03 +02:00
parent d2fc78b319
commit 8b95078223
2 changed files with 11 additions and 2 deletions

View file

@ -192,6 +192,9 @@ function handleSpace(): void {
MonkeyPower.addPower(isWordCorrect, true);
TestInput.incrementAccuracy(isWordCorrect);
if (isWordCorrect) {
if (Config.indicateTypos !== "off" && Config.stopOnError === "letter") {
TestUI.updateWordElement();
}
PaceCaret.handleSpace(true, currentWord);
TestInput.input.pushHistory();
TestWords.words.increaseCurrentIndex();
@ -590,6 +593,9 @@ function handleChar(
Config.stopOnError === "letter" &&
!thisCharCorrect
) {
if (Config.indicateTypos !== "off") {
TestUI.updateWordElement(undefined, TestInput.input.current + char);
}
return;
}

View file

@ -536,8 +536,11 @@ export async function screenshot(): Promise<void> {
}, 3000);
}
export function updateWordElement(showError = !Config.blindMode): void {
const input = TestInput.input.current;
export function updateWordElement(
showError = !Config.blindMode,
inputOverride?: string
): void {
const input = inputOverride || TestInput.input.current;
const wordAtIndex = <Element>document.querySelector("#words .word.active");
const currentWord = TestWords.words.getCurrent();
if (!currentWord && Config.mode !== "zen") return;