fix: active word duplication in code quotes

closes #5505
This commit is contained in:
Miodec 2024-07-03 13:02:57 +02:00
parent d6a3cd08ea
commit 8beddebbd4

View file

@ -768,15 +768,20 @@ function handleChar(
const doesCurrentWordHaveTab = /^\t+/.test(TestWords.words.getCurrent());
const isCurrentCharTab = currentWord[TestInput.input.current.length] === "\t";
if (
thisCharCorrect &&
Config.language.startsWith("code") &&
doesCurrentWordHaveTab &&
isCurrentCharTab
) {
const tabEvent = new KeyboardEvent("keydown", { key: "Tab", code: "Tab" });
document.dispatchEvent(tabEvent);
}
setTimeout(() => {
if (
thisCharCorrect &&
Config.language.startsWith("code") &&
doesCurrentWordHaveTab &&
isCurrentCharTab
) {
const tabEvent = new KeyboardEvent("keydown", {
key: "Tab",
code: "Tab",
});
document.dispatchEvent(tabEvent);
}
}, 0);
if (char !== "\n") {
void Caret.updatePosition();