emacs-diffs
[Top][All Lists]
Advanced

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

master dffc34a2d4: Fix 'text-property-search-backward' with 1-char long


From: Eli Zaretskii
Subject: master dffc34a2d4: Fix 'text-property-search-backward' with 1-char long properties
Date: Thu, 3 Nov 2022 05:27:01 -0400 (EDT)

branch: master
commit dffc34a2d4a2320acd2ce454115f2c9631eb4ce2
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix 'text-property-search-backward' with 1-char long properties
    
    * lisp/emacs-lisp/text-property-search.el
    (text-property--find-end-backward): Don't miss the end of
    text-property value at point.  This fixes searches backward when
    the property is on a single character position.  (Bug#58937)
---
 lisp/emacs-lisp/text-property-search.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/text-property-search.el 
b/lisp/emacs-lisp/text-property-search.el
index d11980f4f4..d41222bdbf 100644
--- a/lisp/emacs-lisp/text-property-search.el
+++ b/lisp/emacs-lisp/text-property-search.el
@@ -208,8 +208,14 @@ and if a matching region is found, place point at the 
start of the region."
                 (goto-char end)
                 (setq ended t)))))
       ;; End this at the first place the property changes value.
-      (setq end (previous-single-property-change
-                 (point) property nil (point-min)))
+      (setq end
+            (if (and (> (point) (point-min))
+                     (text-property--match-p
+                      value (get-text-property (1- (point)) property)
+                      predicate))
+                (previous-single-property-change (point)
+                                                 property nil (point-min))
+              (point)))
       (goto-char end))
     (make-prop-match :beginning end
                      :end (1+ start)



reply via email to

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