+ function replaceLineStartForOrderedList() {
+ const cursor = cm.getCursor();
+ const prevLineContent = cm.getLine(cursor.line - 1) || '';
+ const listMatch = prevLineContent.match(/^(\s*)(\d)([).])\s/) || [];
+
+ const number = (Number(listMatch[2]) || 0) + 1;
+ const whiteSpace = listMatch[1] || '';
+ const listMark = listMatch[3] || '.'
+
+ const prefix = `${whiteSpace}${number}${listMark}`;
+ return replaceLineStart(prefix);
+ }
+