Subject: Re: bug#79275: 30.2.50; overlay line-prefix display property fighting with text display property

From: "J.D. Smith" <[email-masked]>
Date: Wed, 20 Aug 2025 11:06:20 -0400

Eli Zaretskii <[email-masked]> writes:

>> From: JD Smith <[email-masked]>
>> Date: Tue, 19 Aug 2025 21:39:38 -0400
>> 
>> An overlay which applies a line-prefix (e.g. to set the fringe) across several lines conflicts with underlying text which has a replacing display property set.  Evaluate the following in the *scratch* buffer, with at least 3 blank lines at the top of the buffer.
>> 
>> (progn
>>   (delete-all-overlays)
>>   (let ((ov (make-overlay 1 4)))
>>     (overlay-put ov 'line-prefix (propertize "SHOULDNOTSEETHIS" 'display
>>                                              '(left-fringe right-triangle success))))
>>   (put-text-property 2 3 'display ">testing fringe display"))
>> 
>> The result is very strange: the SHOULDNOTSEETHIS prefix string appears (sans fringe display), but then vanishes on the next redisplay.  Some (well-balanced) fight between overlay line-prefix display and normal display properties seems to be occurring.
>
> Thanks.
>
> One of the redisplay optimizations we use couldn't cope with this
> tricky situation (a line-prefix immediately followed by a display
> string at the beginning of a line), and needs to be disabled in this
> case.
>
> Does the patch below give good results?

Yes it does, thanks.  There still appears to be another corner case,
however.  If the conflict occurs at the /beginning/ of the overlay:

  (progn
    (delete-all-overlays)
    (let ((ov (make-overlay 1 4)))
      (overlay-put ov 'line-prefix (propertize "SHOULDNOTSEETHIS" 'display
                                               '(left-fringe right-triangle success))))
    (put-text-property 1 2 'display ">testing fringe display")) ;; changed from 2->3 to 1->2

SHOULDNOTSEETHIS still appears (and remains).  That situation is what
actually motivated the report.