summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2022-11-03 11:25:50 +0200
committerEli Zaretskii <eliz@gnu.org>2022-11-03 11:25:50 +0200
commitdffc34a2d4a2320acd2ce454115f2c9631eb4ce2 (patch)
tree3d1848cb383bd2634b3d729a94769561cf4b2c64 /lisp/emacs-lisp
parent1c9d7fba0ae7445f09b5137f077e9d894202be61 (diff)
downloademacs-dffc34a2d4a2320acd2ce454115f2c9631eb4ce2.tar.gz
emacs-dffc34a2d4a2320acd2ce454115f2c9631eb4ce2.tar.bz2
emacs-dffc34a2d4a2320acd2ce454115f2c9631eb4ce2.zip
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)
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/text-property-search.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/text-property-search.el b/lisp/emacs-lisp/text-property-search.el
index d11980f4f45..d41222bdbf1 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)