Subject: Re: bug#73600: 31.0.50; Visual wrap prefix mode and image display

From: Eli Zaretskii <[email-masked]>
Date: Tue, 27 May 2025 14:06:04 +0300

> Date: Mon, 26 May 2025 16:30:22 -0700
> Cc: [email-masked], [email-masked]
> From: Jim Porter <[email-masked]>
> 
> 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.

The changes LGTM, but why didn't you include in the "safe" display
properties the space-width and min-width properties as well?  In what
way they interfere with visual-wrap?  And shouldn't the considerations
which led you to consider those properties "unsafe" be spelled out in
the doc string or commentary?  Currently, you only mention replacing
specs there.

Thanks.