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

From: Eli Zaretskii <[email-masked]>
Date: Wed, 20 Aug 2025 19:13:30 +0300

> From: "J.D. Smith" <[email-masked]>
> Cc: [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.

That's a completely different problem, and I've run out of free time
for debugging this stuff today.  So this will have to wait till I
have time again.  Or maybe someone else will beat me to it.

In the future, please make an effort to describe all of the situations
you found that produce unexpected results, especially if some
situation was the original motivation for the bug report.  It is not
easy for me to find enough time to set up a debugging session and step
through this tricky code, so I prefer not to invest that overhead more
than just once for a given bug report.  Please keep that in mind when
you decide what to tell and what not to tell, and please don't assume
that everything you see is the consequence of the same problem in the
code.

TIA