unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: JD Smith <jdtsmith@gmail.com>
Cc: 65105@debbugs.gnu.org
Subject: bug#65105: Reusing the same string as 'display on consecutive characters evades display
Date: Sat, 05 Aug 2023 22:03:35 +0300	[thread overview]
Message-ID: <83tttdqpko.fsf@gnu.org> (raw)
In-Reply-To: <E5E1439B-082D-4A65-8F0C-E3BA4026BE26@gmail.com> (message from JD Smith on Sat, 5 Aug 2023 14:35:23 -0400)

tags 65105 notabug
thanks

> From: JD Smith <jdtsmith@gmail.com>
> Date: Sat, 5 Aug 2023 14:35:23 -0400
> 
> Evaluate:
> 
> (let ((s1 "test1")
>       (s2 "test2"))
>   (insert "\n"
>           (propertize " " 'display s1)
>           (propertize " " 'display s1)
>           (propertize " " 'display s2)
>           (propertize " " 'display s1)))
> 
> 
> The first space display does not take effect, since the s1 string is used for two consecutive characters.  This has a practical impact for font-lock backends that use the ‘display text-property and would like to minimize string allocation.  

Emacs cannot distinguish between two consecutive characters having
each a text property with the same value, and two characters having
the same property.  If you think about this for a moment, you will
understand why: we use intervals for text properties, so two adjacent
intervals with the identical property values and one interval with
that same value are indistinguishable (and in fact Emacs optimizes
this during GC by making just one interval from these two).

This is not a bug.





  reply	other threads:[~2023-08-05 19:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-05 18:35 bug#65105: Reusing the same string as 'display on consecutive characters evades display JD Smith
2023-08-05 19:03 ` Eli Zaretskii [this message]
2023-08-05 20:49   ` JD Smith
2023-08-05 22:46     ` Dmitry Gutov
2023-08-05 22:49       ` JD Smith
2023-08-06  4:55         ` Eli Zaretskii
2023-08-06  4:54       ` Eli Zaretskii
2023-08-06 17:48         ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83tttdqpko.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=65105@debbugs.gnu.org \
    --cc=jdtsmith@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).