[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dslide 0a0ca5faf1 1/3: ! Prevent overlay leakage
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dslide 0a0ca5faf1 1/3: ! Prevent overlay leakage |
Date: |
Thu, 21 Nov 2024 06:59:41 -0500 (EST) |
branch: elpa/dslide
commit 0a0ca5faf1355b45ed976f73cdb0fe0b76bded7f
Author: Psionik K <73710933+psionic-k@users.noreply.github.com>
Commit: Psionik K <73710933+psionic-k@users.noreply.github.com>
! Prevent overlay leakage
At some point, I began recommending to users to just use `dslide-overlays'
as a
dumping ground for overlays they wanted to be cleaned up when the slide was
"done". However, these were not being cleaned up, resulting in duplicate
overlays.
`dslide-overlays' works really well for overlays that don't change
throughout
the lifecycle of a slide. The "correct" point to delete these is when the
restriction changes, usually meaning we're on a new slide.
If the new restriction is not included in the existing restriction, we
cleanup
overlays. However, this doesn't properly handle the case that the new
restriction contains the old restriction, meaning some of the existing
overlays
may still be live.
---
dslide.el | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/dslide.el b/dslide.el
index 5ebb0e17a8..9c05fab2ae 100644
--- a/dslide.el
+++ b/dslide.el
@@ -406,7 +406,9 @@ This is global. If a presentation is active, you can look
at this variable to
coordinate with it.")
(defvar dslide-overlays nil
- "Overlays used to hide or change contents display.")
+ "Overlays used to hide or change contents display.
+These are cleaned up when the restriction is changed or when switching
+between contents and slides.")
(defvar dslide--step-overlays nil
"Overlays that only live for one step.")
@@ -1760,6 +1762,14 @@ restriction, meaning no progress was made.")
(dslide--section-end heading))))
(unless (and (<= (point-min) begin)
(>= (point-max) end))
+ ;; Restriction changes are a good moment to clean up overlays dumped
+ ;; into `dslide-overlays'. ⚠️ However, this doesn't properly handle
+ ;; the case that the new restriction contains the old restriction,
+ ;; meaning some of the existing overlays may still be necessary. This
+ ;; should be good for now since there are no known cases where this
+ ;; edge case is reached.
+ (while dslide-overlays
+ (delete-overlay (pop dslide-overlays)))
(narrow-to-region begin end)
(dslide-hide-filtered-children obj)
(when (and dslide-slide-in-effect