Jelajahi Sumber

Merge branch 'maint'

Nicolas Goaziou 4 tahun lalu
induk
melakukan
b49aabdba4
2 mengubah file dengan 12 tambahan dan 7 penghapusan
  1. 6 7
      lisp/org-list.el
  2. 6 0
      testing/lisp/test-org-list.el

+ 6 - 7
lisp/org-list.el

@@ -1325,13 +1325,12 @@ This function modifies STRUCT."
 	  (setcar (nthcdr 6 e) (+ end size-offset)))
 	 ;; Items starting after modified item fall into two
 	 ;; categories.  If item was split, and current item was
-	 ;; located after split point, it was moved to the new
-	 ;; item. Practically speaking, this means that the part
-	 ;; between body start of body and split point was removed.
-	 ;; So we compute the offset and shit item's positions
-	 ;; accordingly.  In any other case, the item was simply
-	 ;; shifted by ITEM-SIZE.
-	 ((and split-line-p (not beforep) (>= p pos))
+	 ;; located after split point, it was moved to the new item.
+	 ;; This means that the part between body start of body and
+	 ;; split point was removed.  So we compute the offset and
+	 ;; shift item's positions accordingly.  In any other case,
+	 ;; the item was simply shifted by ITEM-SIZE.
+	 ((and split-line-p (not beforep) (>= p pos) (<= p item-end-no-blank))
 	  (let ((offset (- pos item ind (length bullet) (length after-bullet))))
 	    (setcar e (- p offset))
 	    (setcar (nthcdr 6 e) (- end offset))))

+ 6 - 0
testing/lisp/test-org-list.el

@@ -787,6 +787,12 @@ b. Item 2<point>"
 	    (let ((org-M-RET-may-split-line  '((default . nil))))
 	      (org-insert-item))
 	    (buffer-string))))
+  ;; Re-order automatically.
+  (should
+   (equal "1. A\n\n2. \n\n3. \n\n4. B"
+	  (org-test-with-temp-text "1. A<point>\n\n2. \n\n3. B"
+	    (org-insert-item)
+	    (buffer-string))))
   ;; Preserve list visibility when inserting an item.
   (should
    (equal