diff options
| author | Eli Zaretskii | 2022-11-03 11:25:50 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2022-11-03 11:25:50 +0200 |
| commit | dffc34a2d4a2320acd2ce454115f2c9631eb4ce2 (patch) | |
| tree | 3d1848cb383bd2634b3d729a94769561cf4b2c64 | |
| parent | 1c9d7fba0ae7445f09b5137f077e9d894202be61 (diff) | |
| download | emacs-dffc34a2d4a2320acd2ce454115f2c9631eb4ce2.tar.gz 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)
| -rw-r--r-- | lisp/emacs-lisp/text-property-search.el | 10 |
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." | |||
| 208 | (goto-char end) | 208 | (goto-char end) |
| 209 | (setq ended t))))) | 209 | (setq ended t))))) |
| 210 | ;; End this at the first place the property changes value. | 210 | ;; End this at the first place the property changes value. |
| 211 | (setq end (previous-single-property-change | 211 | (setq end |
| 212 | (point) property nil (point-min))) | 212 | (if (and (> (point) (point-min)) |
| 213 | (text-property--match-p | ||
| 214 | value (get-text-property (1- (point)) property) | ||
| 215 | predicate)) | ||
| 216 | (previous-single-property-change (point) | ||
| 217 | property nil (point-min)) | ||
| 218 | (point))) | ||
| 213 | (goto-char end)) | 219 | (goto-char end)) |
| 214 | (make-prop-match :beginning end | 220 | (make-prop-match :beginning end |
| 215 | :end (1+ start) | 221 | :end (1+ start) |