Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion frontend/src/html/pages/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -539,12 +539,15 @@
</div>
<div class="text">
Shows typos that you've made. Below shows what you typed below the
letters and replace will replace the letters with the ones you typed.
letters, replace will replace the letters with the ones you typed and
all will do the same as replace and below, but it will show the correct
letters below your mistakes.
</div>
<div class="buttons">
<button data-config-value="off">off</button>
<button data-config-value="below">below</button>
<button data-config-value="replace">replace</button>
<button data-config-value="all">all</button>
</div>
</div>
<div class="section" data-config-name="hideExtraLetters">
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/ts/controllers/input-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,11 @@ async function handleChar(
!TestUI.lineTransition
// TestInput.input.current.length > 1
) {
if (Config.mode === "zen" || Config.indicateTypos === "replace") {
if (
Config.mode === "zen" ||
Config.indicateTypos === "replace" ||
Config.indicateTypos === "all"
) {
if (!Config.showAllLines) void TestUI.lineJump(activeWordTopBeforeJump);
} else {
TestInput.input.current = TestInput.input.current.slice(0, -1);
Expand Down
18 changes: 13 additions & 5 deletions frontend/src/ts/test/test-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ function updateWordWrapperClasses(): void {
$("#wordsWrapper").removeClass("blind");
}

if (Config.indicateTypos === "below") {
if (Config.indicateTypos === "below" || Config.indicateTypos === "all") {
$("#words").addClass("indicateTyposBelow");
$("#wordsWrapper").addClass("indicateTyposBelow");
} else {
Expand Down Expand Up @@ -791,7 +791,7 @@ export async function updateActiveWordLetters(
!(containsKorean && !correctSoFar)
) {
ret += `<letter class="dead">${
Config.indicateTypos === "replace"
Config.indicateTypos === "replace" || Config.indicateTypos === "all"
? inputChars[i] === " "
? "_"
: inputChars[i]
Expand All @@ -806,13 +806,16 @@ export async function updateActiveWordLetters(
} else {
ret +=
`<letter class="incorrect ${tabChar}${nlChar}">` +
(Config.indicateTypos === "replace"
(Config.indicateTypos === "replace" || Config.indicateTypos === "all"
? inputChars[i] === " "
? "_"
: inputChars[i]
: currentLetter) +
"</letter>";
if (Config.indicateTypos === "below") {
if (
Config.indicateTypos === "below" ||
Config.indicateTypos === "all"
) {
const lastBlock = hintIndices[hintIndices.length - 1];
if (lastBlock && lastBlock[lastBlock.length - 1] === i - 1)
lastBlock.push(i);
Expand All @@ -839,7 +842,12 @@ export async function updateActiveWordLetters(

if (hintIndices?.length) {
const activeWordLetters = activeWord.querySelectorAll("letter");
const hintsHtml = createHintsHtml(hintIndices, activeWordLetters, input);
let hintsHtml;
if (Config.indicateTypos === "all") {
hintsHtml = createHintsHtml(hintIndices, activeWordLetters, currentWord);
} else {
hintsHtml = createHintsHtml(hintIndices, activeWordLetters, input);
}
activeWord.insertAdjacentHTML("beforeend", hintsHtml);
const hintElements = activeWord.getElementsByTagName("hint");
await joinOverlappingHints(hintIndices, activeWordLetters, hintElements);
Expand Down
2 changes: 1 addition & 1 deletion packages/schemas/src/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export type CaretStyle = z.infer<typeof CaretStyleSchema>;
export const ConfidenceModeSchema = z.enum(["off", "on", "max"]);
export type ConfidenceMode = z.infer<typeof ConfidenceModeSchema>;

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

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