diff --git a/src/composables/helper.ts b/src/composables/helper.ts index 9691ca6..da62137 100644 --- a/src/composables/helper.ts +++ b/src/composables/helper.ts @@ -5,7 +5,8 @@ export const insertText = ref("") export const cTexts = [ ",", ";", - "printf();", + 'printf("");', + 'scanf("");', "{\n}", "int", "%d", diff --git a/src/mobile/Content.vue b/src/mobile/Content.vue index e040326..81b6a2f 100644 --- a/src/mobile/Content.vue +++ b/src/mobile/Content.vue @@ -48,6 +48,8 @@ whenever(insertText, (text: string) => { if (text === "{}") delta = 1 // range(): if (text.slice(len - 2) === "):") delta = 2 + // printf(""); scanf(""); + if (text.slice(len - 3) === '");') delta = 3 if (delta > 0) { const pos = codeEditor.state.selection.main.head - delta codeEditor.dispatch({