Browse Source

inlinetask: Fix folding of directly consecutive inlinetask children

Marco Wahl 7 years ago
parent
commit
e401afffde
2 changed files with 26 additions and 2 deletions
  1. 3 1
      lisp/org-inlinetask.el
  2. 23 1
      testing/lisp/test-org-inlinetask.el

+ 3 - 1
lisp/org-inlinetask.el

@@ -334,7 +334,9 @@ This function is meant to be used in `org-cycle-hook'."
 	   (org-inlinetask-goto-end)))))
     (`children
      (save-excursion
-       (while (and (outline-next-heading) (org-inlinetask-at-task-p))
+       (while
+	   (or (org-inlinetask-at-task-p)
+	       (and (outline-next-heading) (org-inlinetask-at-task-p)))
 	 (org-inlinetask-toggle-visibility)
 	 (org-inlinetask-goto-end))))))
 

+ 23 - 1
testing/lisp/test-org-inlinetask.el

@@ -119,7 +119,7 @@ http://lists.gnu.org/archive/html/emacs-orgmode/2017-12/msg00502.html"
      (org-cycle-internal-local)
      (invisible-p (1- (search-forward "- b"))))))
 
-(ert-deftest test-org-inlinetask/folding-directly-consecutive-tasks ()
+(ert-deftest test-org-inlinetask/folding-directly-consecutive-tasks/0 ()
   "Fold directly consecutive inlinetasks."
   (should
    (org-test-with-temp-text
@@ -135,6 +135,28 @@ http://lists.gnu.org/archive/html/emacs-orgmode/2017-12/msg00502.html"
      (org-cycle-internal-local)
      (invisible-p (1- (search-forward "- b"))))))
 
+(ert-deftest test-org-inlinetask/folding-directly-consecutive-tasks/1 ()
+  "Fold directly consecutive inlinetasks."
+  (should
+   (org-test-with-temp-text
+       "<point>* Test
+*************** p1
+p2
+*************** END
+*************** p3
+p4
+*************** END
+
+"
+     (outline-hide-subtree)
+     (org-cycle)
+     (and
+      (not (invisible-p (1- (search-forward "p1"))))
+      (invisible-p (1- (search-forward "p2")))
+      (not (invisible-p (1- (search-forward "p3"))))
+      (invisible-p (1- (search-forward "p4")))))))
+
+
 
 (provide 'test-org-inlinetask)