Subject: Reusing the same string as 'display on consecutive characters evades display
From: JD Smith <[email-masked]>
To: [email-masked]
Date: Sat, 5 Aug 2023 14:35:23 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

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.  

Tested Emacs 27/28/29.