dwim: fix ordered list bullet increment

This commit is contained in:
leizhe
2021-10-08 16:09:03 +08:00
committed by Tienson Qin
parent 515cf6f010
commit be24c3a43b
2 changed files with 6 additions and 5 deletions

View File

@@ -2317,13 +2317,14 @@
"list-item"
(let [{:keys [full-content indent bullet checkbox ordered _]} thing-at-point
next-bullet (if ordered
(str (inc bullet) ".")
(str (inc (cljs.reader/read-string bullet)) ".")
bullet)
checkbox (when checkbox " [ ]")]
(if (= (count full-content) (+ (if ordered (+ (count bullet) 2) 2) (count checkbox)))
checkbox (when checkbox "[ ] ")]
(if (= (count full-content)
(+ (if ordered (+ (count bullet) 2) 2) (when checkbox (count checkbox))))
(delete-and-update input (cursor/line-beginning-pos input) (cursor/line-end-pos input))
(do (cursor/move-cursor-to-line-end input)
(insert (str "\n" indent next-bullet checkbox " ")))))
(insert (str "\n" indent next-bullet " " checkbox)))))
"properties-drawer"
(let [property-key (:raw-content (thingatpt/property-key-at-point input))
move-to-pos (if (= (:block/format config) :org) 2 3)]