diff --git a/frontend/src/ts/test/test-ui.ts b/frontend/src/ts/test/test-ui.ts index 05011e84e..459e1d471 100644 --- a/frontend/src/ts/test/test-ui.ts +++ b/frontend/src/ts/test/test-ui.ts @@ -1259,6 +1259,72 @@ export function setLigatures(isEnabled: boolean): void { } } +function buildWordLettersHTML( + charCount: number, + input: string, + corrected: string, + inputCharacters: string[], + wordCharacters: string[], + correctedCharacters: string[], + containsKorean: boolean +): string { + let out = ""; + for (let c = 0; c < charCount; c++) { + let correctedChar; + try { + correctedChar = !containsKorean + ? correctedCharacters[c] + : Hangul.assemble(corrected.split(""))[c]; + } catch (e) { + correctedChar = undefined; + } + let extraCorrected = ""; + const historyWord: string = !containsKorean + ? corrected + : Hangul.assemble(corrected.split("")); + if ( + c + 1 === charCount && + historyWord !== undefined && + historyWord.length > input.length + ) { + extraCorrected = "extraCorrected"; + } + if (Config.mode === "zen" || wordCharacters[c] !== undefined) { + if (Config.mode === "zen" || inputCharacters[c] === wordCharacters[c]) { + if ( + correctedChar === inputCharacters[c] || + correctedChar === undefined + ) { + out += `${inputCharacters[c]}`; + } else { + out += + `` + + inputCharacters[c] + + ""; + } + } else { + if (inputCharacters[c] === TestInput.input.current) { + out += + `` + + wordCharacters[c] + + ""; + } else if (inputCharacters[c] === undefined) { + out += "" + wordCharacters[c] + ""; + } else { + out += + `` + + wordCharacters[c] + + ""; + } + } + } else { + out += + '' + inputCharacters[c] + ""; + } + } + return out; +} + async function loadWordsHistory(): Promise { $("#resultWordsHistory .words").empty(); let wordsHTML = ""; @@ -1312,64 +1378,15 @@ async function loadWordsHistory(): Promise { if (corrected === undefined) throw new Error("empty corrected word"); - for (let c = 0; c < loop; c++) { - let correctedChar; - try { - correctedChar = !containsKorean - ? correctedCharacters[c] - : Hangul.assemble(corrected.split(""))[c]; - } catch (e) { - correctedChar = undefined; - } - let extraCorrected = ""; - const historyWord: string = !containsKorean - ? corrected - : Hangul.assemble(corrected.split("")); - if ( - c + 1 === loop && - historyWord !== undefined && - historyWord.length > input.length - ) { - extraCorrected = "extraCorrected"; - } - if (Config.mode === "zen" || wordCharacters[c] !== undefined) { - if ( - Config.mode === "zen" || - inputCharacters[c] === wordCharacters[c] - ) { - if ( - correctedChar === inputCharacters[c] || - correctedChar === undefined - ) { - wordEl += `${inputCharacters[c]}`; - } else { - wordEl += - `` + - inputCharacters[c] + - ""; - } - } else { - if (inputCharacters[c] === TestInput.input.current) { - wordEl += - `` + - wordCharacters[c] + - ""; - } else if (inputCharacters[c] === undefined) { - wordEl += "" + wordCharacters[c] + ""; - } else { - wordEl += - `` + - wordCharacters[c] + - ""; - } - } - } else { - wordEl += - '' + - inputCharacters[c] + - ""; - } - } + wordEl += buildWordLettersHTML( + loop, + input, + corrected, + inputCharacters, + wordCharacters, + correctedCharacters, + containsKorean + ); wordEl += ""; } catch (e) { try { diff --git a/packages/oxlint-config/index.json b/packages/oxlint-config/index.json index fae074052..842b00bfa 100644 --- a/packages/oxlint-config/index.json +++ b/packages/oxlint-config/index.json @@ -79,12 +79,10 @@ "eqeqeq": "error", "ban-ts-comment": "error", "no-unassigned-vars": "error", - - "todo-lowerthis": "off", "max-depth": [ "error", { - "max": 6 + "max": 5 } ],