Subject: Re: bug#73600: 31.0.50; Visual wrap prefix mode and image display
From: Jim Porter <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Mon, 26 May 2025 16:30:22 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On 10/19/2024 1:23 AM, Eli Zaretskii wrote:
> I think at this stage it is basically up to you which version to
> install.  Adding tests is always welcome, of course, regardless of
> which version is installed.

This is much-delayed, but now that I'm back from an extended break, I've 
now merged the "safer" version of my change as <>.

Here's a short summary of the issue: the new visual-wrap code inserts a 
'min-width' display property to make sure everything lines up. This 
usually works ok, but fails when a "replacing" display spec spans 
multiple lines of the buffer text. That comes up in 'image-mode', where 
the buffer text is the image data, and we apply a display spec to show 
the image. If the image data contains a 0x0a byte (line feed), then the 
visual-wrap code would insert a 'min-width' property on *part* of the 
buffer contents, confusing the display engine into thinking should be 
multiple images.

The fix is to skip past any replacing display specs when scanning the 
buffer. The new code also includes a list of known-safe display specs 
that don't have this problem: 'visual-wrap--safe-display-specs'. I was 
intentionally conservative with that list, but we could add more to it 
as needed.

I've tried many different variations to try to break the "safe" version 
of my patch (which I still think is less strictly-correct than the other 
version), but I couldn't. Since the difference likely won't come up, I 
opted to merge the patch that Eli felt more comfortable with.

I've marked this bug as done, but if I've missed anything, just let me know.