1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-25 07:28:20 +00:00

Backport: Rectify allout-widgets region undecoration so item at start is not missed.

* lisp/allout-widgets.el (allout-widgets-undecorate-region):
Reorganize the loop so an item at the start is not skipped.

(cherry picked from commit 33d85cb768)
This commit is contained in:
Ken Manheimer 2020-07-05 16:38:13 -04:00
parent 82742e295d
commit bc10e467f1

View File

@ -2060,19 +2060,22 @@ Optional FORCE means force reassignment of the region property."
;;;_ > allout-widgets-undecorate-region (start end)
(defun allout-widgets-undecorate-region (start end)
"Eliminate widgets and decorations for all items in region from START to END."
(let ((next start)
widget)
(let (done next widget
(end (or end (point-max))))
(save-excursion
(goto-char start)
(while (< (setq next (next-single-char-property-change next
'display
(current-buffer)
end))
end)
(goto-char next)
(when (setq widget (allout-get-item-widget))
;; if the next-property/overly progression got us to a widget:
(allout-widgets-undecorate-item widget t))))))
(while (not done)
(when (and (allout-on-current-heading-p)
(setq widget (allout-get-item-widget)))
(if widget
(allout-widgets-undecorate-item widget t)))
(goto-char (setq next
(next-single-char-property-change (point)
'display
(current-buffer)
end)))
(if (>= next end)
(setq done t))))))
;;;_ > allout-widgets-undecorate-text (text)
(defun allout-widgets-undecorate-text (text)
"Eliminate widgets and decorations for all items in TEXT."