Subject: Re: bug#71605: 30.0.50; [PATCH] Support variable-width text in 'visual-wrap-prefix-mode'

From: Jim Porter <[email-masked]>
Date: Sun, 4 Aug 2024 12:24:38 -0700

On 8/2/2024 12:27 AM, Eli Zaretskii wrote:
> LGTM, thanks.  Feel free to install on master.

Thanks, merged to master as f70a6ea0ea8.

Hopefully this patch maintains all the existing correct behaviors and 
fixes most of the issues with variable-pitch text. To summarize, this is 
how things *should* behave (anything else is probably a mistake; just 
let me know and I'll try to fix it):

1. With fixed-pitch fonts, everything should look the same as before.

2. With variable-pitch fonts in a terminal frame, everything should look
    the same as before, but...

    a. If you then open that buffer in a GUI frame, there's a small
       chance that the first line of a bulleted list will be too wide.
       This can happen if the prefix contains wider-than-average
       characters in the specified font.

3. With variable-pitch fonts in a GUI frame, wrapped lines in bulleted
    lists and the like should now lined up correctly in GUI , but...

   a. The first line might have a bit of extra space after the bullet.
      (The space occupied by "* " or what-have-you is rounded up to an
      integer number of canonical-width spaces.)

   b. If you then open that same buffer in a terminal frame, there's a
      small chance that the text after the bullet will have an extra
      space (same with the wrapped text). This can happen if the prefix
      contains wider-than-average characters in the specified font.

   c. If you change the font of the wrapped text to something with
      different metrics, there's a small chance that the first line of a
      bulleted list will be too wide.

2a and 3b would probably be fixable by using overlays restricted to a 
particular window. 3c would probably be fixable by calling 
'jit-lock-refontify' at the appropriate time.

While that's quite a few caveats with the current implementation, I 
think overall they should only come up in rare cases, and should never 
affect fixed-pitch text (which is the only thing 
'visual-wrap-prefix-mode' could work correctly with before).