This repository was archived by the owner on Sep 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
app/src/main/java/com/yangdai/opennote/presentation/component/note Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -274,7 +274,7 @@ fun LiteTextField(
274274
275275 if (selection.start == currentLineEnd &&
276276 (trimmedLine == " - [ ]" || trimmedLine == " -" || trimmedLine == " *" || trimmedLine == " +"
277- || trimmedLine.matches(Regex (" ^\\ d+\\ .$" )))
277+ || trimmedLine.matches(Regex (" ^\\ d+\\ .$" )) || trimmedLine.matches( Regex ( " ^ \\ d+ \\ )$ " )) )
278278 ) {
279279 val newText = StringBuilder (currentText)
280280 .delete(currentLineStart, currentLineEnd)
@@ -297,7 +297,12 @@ fun LiteTextField(
297297 ?.plus(1 ) ? : 1
298298 " $nextNumber . "
299299 }
300-
300+ trimmedLine.matches(Regex (" ^\\ d+\\ )\\ s.*" )) -> {
301+ val nextNumber =
302+ trimmedLine.substringBefore(" )" ).toIntOrNull()
303+ ?.plus(1 ) ? : 1
304+ " $nextNumber ) "
305+ }
301306 trimmedLine.startsWith(" - " ) -> " - "
302307 trimmedLine.startsWith(" * " ) -> " * "
303308 trimmedLine.startsWith(" + " ) -> " + "
Original file line number Diff line number Diff line change @@ -388,7 +388,7 @@ fun StandardTextField(
388388 // 处理空列表项
389389 if (selection.start == currentLineEnd &&
390390 (trimmedLine == " - [ ]" || trimmedLine == " -" || trimmedLine == " *" || trimmedLine == " +"
391- || trimmedLine.matches(Regex (" ^\\ d+\\ .$" )))
391+ || trimmedLine.matches(Regex (" ^\\ d+\\ .$" )) || trimmedLine.matches( Regex ( " ^ \\ d+ \\ )$ " )) )
392392 ) {
393393 state.edit {
394394 delete(currentLineStart, currentLineEnd)
@@ -404,7 +404,12 @@ fun StandardTextField(
404404 ? : 1
405405 " $nextNumber . " // 有序列表
406406 }
407-
407+ trimmedLine.matches(Regex (" ^\\ d+\\ )\\ s.*" )) -> {
408+ val nextNumber =
409+ trimmedLine.substringBefore(" )" ).toIntOrNull()?.plus(1 )
410+ ? : 1
411+ " $nextNumber ) " // 有序列表
412+ }
408413 trimmedLine.startsWith(" - " ) -> " - " // 无序列表
409414 trimmedLine.startsWith(" * " ) -> " * "
410415 trimmedLine.startsWith(" + " ) -> " + "
You can’t perform that action at this time.
0 commit comments