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

From: Jim Porter <[email-masked]>
Date: Mon, 17 Jun 2024 09:13:38 -0700

On 6/17/2024 7:23 AM, Po Lu via Bug reports for GNU Emacs, the Swiss 
army knife of text editors wrote:
> Actually, there's more than just this one problem.  To start with, the
> existing format of the generated line prefix properties enables the
> extracted fill prefix to be displayed consistently on any frame,
> whatever the metrics of its default font/face.  This I consider a far
> more critical capability than perfect alignment of wrapped text in the
> presence of a variable-pitch default font, as the latter is virtually
> unknown among programmers, and also unimplementable within reasonable
> standards of performance with pixelwise spacers.

That's a good point. In practice, we should only do this if the 
first-line prefix uses a variable-pitch font, since otherwise we might 
as well just use the requisite number of space characters as before, 
sans display-spec.

> If this is to be
> installed, please condition it behind a user option and restore the
> existing logic that you have effaced as the default.

I'll add a check for variable-pitch fonts and a user option. With the 
variable-pitch check, I think it should be ok for the user option to 
default to enabling this new behavior? For fixed-pitch fonts, the new 
code would behave the same as before regardless of the option.

Note that I haven't removed any of the old logic though; it's all there 
as before, since the space characters are useful for terminals (where 
the pixelwise :width display-spec doesn't do anything for us, if I 
understand correctly). I did extract parts of 'fill-content-prefix' into 
'visual-wrap--content-prefix', but the only parts I removed were the 
ones for handling multiple lines; those don't apply here, since 
'visual-wrap-prefix-function' gets the prefixes one line at a time.