]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix 'text-property-search-backward' with 1-char long properties
authorEli Zaretskii <eliz@gnu.org>
Thu, 3 Nov 2022 09:25:50 +0000 (11:25 +0200)
committerEli Zaretskii <eliz@gnu.org>
Thu, 3 Nov 2022 09:25:50 +0000 (11:25 +0200)
* 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

index d11980f4f45ac0e06116ce6a0b3c5ff88974f03e..d41222bdbf1370e7ed62e4c55d321dcf65ade804 100644 (file)
@@ -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)