upd: reset number on press tab key

This commit is contained in:
purocean
2021-12-19 11:47:17 +08:00
parent dd6b1c0c46
commit ae31cf6f1e
+3 -2
View File
@@ -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}.`))
}
}