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

From: Jim Porter <[email-masked]>
Date: Wed, 2 Oct 2024 09:37:48 -0700

On 10/2/2024 8:51 AM, Eli Zaretskii wrote:
>> Cc: [email-masked]
>> Date: Wed, 02 Oct 2024 18:42:09 +0300
>> From: Eli Zaretskii <[email-masked]>
>>
>>> In emacs -Q:
>>> - enable global-visual-wrap-prefix-mode,
>>> - open the attached image.
>>
>> In a build with --enable-checking, this recipe causes an assertion
>> violation:
> 
> And in Emacs 30 the problem doesn't happen, so this is some regression
> in Emacs 31.  Probably due to my changes in commit 71505b723c9f.
> 
> Jim, any ideas or suggestions?

Strangely, this doesn't seem to happen with every image. "splash.png" in 
the Emacs repository seems fine, for example. I also can't reproduce 
this in EWW, even by opening the bad image reported in this bug.

I haven't looked into the internals of 'image-mode' very much, but I 
seem to recall that it has some special code for scrolling large images. 
Maybe that's interacting in some bad way with 'visual-wrap-prefix-mode'?

One option might simply be to disable 'visual-wrap-prefix-mode' when in 
'image-mode'. I don't think wrapping is useful in that context.