diff --git a/src/renderer/plugins/editor-markdown.ts b/src/renderer/plugins/editor-markdown.ts index 0d5b3d89..d4ba4ed6 100644 --- a/src/renderer/plugins/editor-markdown.ts +++ b/src/renderer/plugins/editor-markdown.ts @@ -139,9 +139,10 @@ function processCursorChange (source: string, position: Monaco.Position) { const reg = /^\s*(\d+)\./ const match = prevContent.match(reg) if (match && reg.test(content)) { - const num = parseInt(match[0] || '0') + const num = isTab ? 0 : parseInt(match[0] || '0') + // only increase above 1 - if (num > 1) { + if (num > 1 || isTab) { replaceLine(line, content.replace(/\d+\./, `${num + 1}.`)) } }