emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/spell-fu aed6e87aa3: spell-fu: improve overlay extending t


From: ELPA Syncer
Subject: [nongnu] elpa/spell-fu aed6e87aa3: spell-fu: improve overlay extending to support non-exact overlaps
Date: Sun, 19 Mar 2023 05:01:44 -0400 (EDT)

branch: elpa/spell-fu
commit aed6e87aa31013534b7a6cbedb26e4f29ccea735
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    spell-fu: improve overlay extending to support non-exact overlaps
---
 spell-fu.el | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/spell-fu.el b/spell-fu.el
index d29ddc25ab..2c6ebc3a04 100644
--- a/spell-fu.el
+++ b/spell-fu.el
@@ -791,22 +791,25 @@ when checking the entire buffer for example."
   (when (and spell-fu--idle-overlay-last (not (overlay-buffer 
spell-fu--idle-overlay-last)))
     (setq spell-fu--idle-overlay-last nil))
 
-  (cond
-   ;; Extend forwards.
-   ((and spell-fu--idle-overlay-last (eq pos-beg (overlay-end 
spell-fu--idle-overlay-last)))
-    (move-overlay spell-fu--idle-overlay-last (overlay-start 
spell-fu--idle-overlay-last) pos-end))
-   ;; Extend backwards.
-   ((and spell-fu--idle-overlay-last (eq pos-end (overlay-start 
spell-fu--idle-overlay-last)))
-    (move-overlay spell-fu--idle-overlay-last pos-beg (overlay-end 
spell-fu--idle-overlay-last)))
-   (t
+  (unless (and spell-fu--idle-overlay-last
+               (let ((last-beg (overlay-start spell-fu--idle-overlay-last))
+                     (last-end (overlay-end spell-fu--idle-overlay-last)))
+                 (cond
+                  ((> last-beg pos-end)
+                   nil)
+                  ((< last-end pos-beg)
+                   nil)
+                  (t ; Extend when overlap.
+                   (move-overlay
+                    spell-fu--idle-overlay-last (min pos-beg last-beg) (max 
pos-end last-end))
+                   t))))
+
     (let ((item-ov (make-overlay pos-beg pos-end)))
       ;; Handy for debugging pending regions to be checked.
       ;; (overlay-put item-ov 'face '(:background "#000000" :extend t))
-
       (overlay-put item-ov 'spell-fu-pending t)
       (overlay-put item-ov 'evaporate 't)
-
-      (setq spell-fu--idle-overlay-last item-ov))))
+      (setq spell-fu--idle-overlay-last item-ov)))
 
   ;; Use `inhibit-quit' as a way to check if `jit-lock-stealth' is in use.
   (when inhibit-quit



reply via email to

[Prev in Thread] Current Thread [Next in Thread]