Skip to content

Commit fc991c1

Browse files
committed
Add all option to indicate typos
1 parent 2f5cb16 commit fc991c1

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

frontend/src/html/pages/settings.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,12 +539,15 @@
539539
</div>
540540
<div class="text">
541541
Shows typos that you've made. Below shows what you typed below the
542-
letters and replace will replace the letters with the ones you typed.
542+
letters, replace will replace the letters with the ones you typed and
543+
all will do the same as replace and below, but it will show the correct
544+
letters below your mistakes.
543545
</div>
544546
<div class="buttons">
545547
<button data-config-value="off">off</button>
546548
<button data-config-value="below">below</button>
547549
<button data-config-value="replace">replace</button>
550+
<button data-config-value="all">all</button>
548551
</div>
549552
</div>
550553
<div class="section" data-config-name="hideExtraLetters">

frontend/src/ts/controllers/input-controller.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,11 @@ async function handleChar(
703703
!TestUI.lineTransition
704704
// TestInput.input.current.length > 1
705705
) {
706-
if (Config.mode === "zen" || Config.indicateTypos === "replace") {
706+
if (
707+
Config.mode === "zen" ||
708+
Config.indicateTypos === "replace" ||
709+
Config.indicateTypos === "all"
710+
) {
707711
if (!Config.showAllLines) void TestUI.lineJump(activeWordTopBeforeJump);
708712
} else {
709713
TestInput.input.current = TestInput.input.current.slice(0, -1);

frontend/src/ts/test/test-ui.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ function updateWordWrapperClasses(): void {
436436
$("#wordsWrapper").removeClass("blind");
437437
}
438438

439-
if (Config.indicateTypos === "below") {
439+
if (Config.indicateTypos === "below" || Config.indicateTypos === "all") {
440440
$("#words").addClass("indicateTyposBelow");
441441
$("#wordsWrapper").addClass("indicateTyposBelow");
442442
} else {
@@ -791,7 +791,7 @@ export async function updateActiveWordLetters(
791791
!(containsKorean && !correctSoFar)
792792
) {
793793
ret += `<letter class="dead">${
794-
Config.indicateTypos === "replace"
794+
Config.indicateTypos === "replace" || Config.indicateTypos === "all"
795795
? inputChars[i] === " "
796796
? "_"
797797
: inputChars[i]
@@ -806,13 +806,16 @@ export async function updateActiveWordLetters(
806806
} else {
807807
ret +=
808808
`<letter class="incorrect ${tabChar}${nlChar}">` +
809-
(Config.indicateTypos === "replace"
809+
(Config.indicateTypos === "replace" || Config.indicateTypos === "all"
810810
? inputChars[i] === " "
811811
? "_"
812812
: inputChars[i]
813813
: currentLetter) +
814814
"</letter>";
815-
if (Config.indicateTypos === "below") {
815+
if (
816+
Config.indicateTypos === "below" ||
817+
Config.indicateTypos === "all"
818+
) {
816819
const lastBlock = hintIndices[hintIndices.length - 1];
817820
if (lastBlock && lastBlock[lastBlock.length - 1] === i - 1)
818821
lastBlock.push(i);
@@ -839,7 +842,12 @@ export async function updateActiveWordLetters(
839842

840843
if (hintIndices?.length) {
841844
const activeWordLetters = activeWord.querySelectorAll("letter");
842-
const hintsHtml = createHintsHtml(hintIndices, activeWordLetters, input);
845+
let hintsHtml;
846+
if (Config.indicateTypos === "all") {
847+
hintsHtml = createHintsHtml(hintIndices, activeWordLetters, currentWord);
848+
} else {
849+
hintsHtml = createHintsHtml(hintIndices, activeWordLetters, input);
850+
}
843851
activeWord.insertAdjacentHTML("beforeend", hintsHtml);
844852
const hintElements = activeWord.getElementsByTagName("hint");
845853
await joinOverlappingHints(hintIndices, activeWordLetters, hintElements);

packages/schemas/src/configs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export type CaretStyle = z.infer<typeof CaretStyleSchema>;
5050
export const ConfidenceModeSchema = z.enum(["off", "on", "max"]);
5151
export type ConfidenceMode = z.infer<typeof ConfidenceModeSchema>;
5252

53-
export const IndicateTyposSchema = z.enum(["off", "below", "replace"]);
53+
export const IndicateTyposSchema = z.enum(["off", "below", "replace", "all"]);
5454
export type IndicateTypos = z.infer<typeof IndicateTyposSchema>;
5555

5656
export const TimerStyleSchema = z.enum(["off", "bar", "text", "mini"]);

0 commit comments

Comments
 (0)