added automatic tabs to code quotes only if the previous enter was typed correctly

closes #4266
This commit is contained in:
Miodec 2023-05-29 13:09:12 +02:00
parent 06075eef5d
commit 2a36a33ee5

View file

@ -295,6 +295,16 @@ function handleSpace(): void {
}
} //end of line wrap
// enable if i decide that auto tab should also work after a space
// if (
// Config.language.startsWith("code") &&
// /^\t+/.test(TestWords.words.getCurrent()) &&
// TestWords.words.getCurrent()[TestInput.input.current.length] === "\t"
// ) {
// //send a tab event using jquery
// $("#wordsInput").trigger($.Event("keydown", { key: "Tab", code: "Tab" }));
// }
if (Config.keymapMode === "react") {
KeymapEvent.flash(" ", true);
}
@ -652,6 +662,16 @@ function handleChar(
handleSpace();
}
if (
thisCharCorrect &&
Config.language.startsWith("code") &&
/^\t+/.test(TestWords.words.getCurrent()) &&
TestWords.words.getCurrent()[TestInput.input.current.length] === "\t"
) {
// handleChar("\t", TestInput.input.current.length);
$("#wordsInput").trigger($.Event("keydown", { key: "Tab", code: "Tab" }));
}
if (char !== "\n") {
Caret.updatePosition();
}