This commit is contained in:
xuyue committed 2024-01-25 10:51:49 +08:00
1 parent cd6b616129
commit 5631d0ba0a
2 files changed
+4 -1

No files matched your search

+2 -1
View File
@@ -5,7 +5,8 @@ export const insertText = ref("")
export const cTexts = [ export const cTexts = [
",", ",",
";", ";",
"printf();", 'printf("");',
'scanf("");',
"{\n}", "{\n}",
"int", "int",
"%d", "%d",
+2
View File
@@ -48,6 +48,8 @@ whenever(insertText, (text: string) => {
if (text === "{}") delta = 1 if (text === "{}") delta = 1
// range(): // range():
if (text.slice(len - 2) === "):") delta = 2 if (text.slice(len - 2) === "):") delta = 2
// printf(""); scanf("");
if (text.slice(len - 3) === '");') delta = 3
if (delta > 0) { if (delta > 0) {
const pos = codeEditor.state.selection.main.head - delta const pos = codeEditor.state.selection.main.head - delta
codeEditor.dispatch({ codeEditor.dispatch({