emacs-diffs
[Top][All Lists]
Advanced

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

master ba12555: Fix NOT-CURRENT behaviour in text-property-search-backwa


From: Lars Ingebrigtsen
Subject: master ba12555: Fix NOT-CURRENT behaviour in text-property-search-backward
Date: Fri, 17 Jul 2020 12:45:03 -0400 (EDT)

branch: master
commit ba12555fda9cdd781b50e60d933aa6b8ba4464b9
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix NOT-CURRENT behaviour in text-property-search-backward
    
    * lisp/emacs-lisp/text-property-search.el
    (text-property-search-backward): Fix inconsistent behaviour of
    S-TAB in eww (and other callers that use the NOT-CURRENT
    behaviour) when there are adjacent elements
    (bug#39239).
---
 lisp/emacs-lisp/text-property-search.el | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/lisp/emacs-lisp/text-property-search.el 
b/lisp/emacs-lisp/text-property-search.el
index b6e98f5..61bd98d 100644
--- a/lisp/emacs-lisp/text-property-search.el
+++ b/lisp/emacs-lisp/text-property-search.el
@@ -137,11 +137,19 @@ and if a matching region is found, moves point to its 
beginning."
     nil)
    ;; We're standing in the property we're looking for, so find the
    ;; end.
-   ((and (text-property--match-p
-          value (get-text-property (1- (point)) property)
-          predicate)
-         (not not-current))
-    (text-property--find-end-backward (1- (point)) property value predicate))
+   ((text-property--match-p
+     value (get-text-property (1- (point)) property)
+     predicate)
+    (let ((origin (point))
+          (match (text-property--find-end-backward
+                  (1- (point)) property value predicate)))
+      ;; When we want to ignore the current element, then repeat the
+      ;; search if we haven't moved out of it yet.
+      (if (and not-current
+               (equal (get-text-property (point) property)
+                      (get-text-property origin property)))
+          (text-property-search-backward property value predicate)
+        match)))
    (t
     (let ((origin (point))
           (ended nil)



reply via email to

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