unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#58937: text-property-search-backward misses one-character regions
@ 2022-10-31 23:20 Nicolas Graner
  2022-11-01 10:24 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Graner @ 2022-10-31 23:20 UTC (permalink / raw)
  To: 58937

In Emacs 29.0.50, when a single character has a text property and you
try to find it with text-property-search-backward, the result
incorrectly includes previous characters without the property.

Example:

(with-current-buffer (generate-new-buffer "test")
  (insert "123456789")
  (put-text-property 3 4 'foo 'bar)
  (goto-char 6)
  (text-property-search-backward 'foo))

The returned value is
  #s(prop-match 1 4 nil)
instead of
  #s(prop-match 3 4 bar)
and the point in the test buffer is moved to position 1 instead of 3.

This incorrect behavior is the same if you replace (goto-char 6) with
(goto-char 5) or any other value greater than 4. However, the result is
correct with (goto-char 4), i.e. when the backward search starts one
position after the target character. This suggests an off-by-one error
in the code.

Hope this helps,
Nicolas





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-11-03  9:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-31 23:20 bug#58937: text-property-search-backward misses one-character regions Nicolas Graner
2022-11-01 10:24 ` Eli Zaretskii
2022-11-01 16:48   ` Nicolas Graner
2022-11-01 16:56     ` Eli Zaretskii
2022-11-01 17:00     ` Eli Zaretskii
2022-11-01 17:05       ` Eli Zaretskii
2022-11-02 23:40         ` Nicolas Graner
2022-11-03  9:35           ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).