GNU bug report logs - #71605
30.0.50; [PATCH] Support variable-width text in 'visual-wrap-prefix-mode'

Previous Next

Package: emacs;

Reported by: Jim Porter <jporterbugs <at> gmail.com>

Date: Mon, 17 Jun 2024 02:57:02 UTC

Severity: normal

Tags: patch

Found in version 30.0.50

Done: Jim Porter <jporterbugs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Jim Porter <jporterbugs <at> gmail.com>
Subject: bug#71605: closed (Re: bug#71605: 30.0.50; [PATCH] Support
 variable-width text in 'visual-wrap-prefix-mode')
Date: Sun, 04 Aug 2024 19:27:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 71605 <at> debbugs.gnu.org.

-- 
71605: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71605
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Jim Porter <jporterbugs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 71605-done <at> debbugs.gnu.org, luangruo <at> yahoo.com
Subject: Re: bug#71605: 30.0.50; [PATCH] Support variable-width text in
 'visual-wrap-prefix-mode'
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).

[Message part 3 (message/rfc822, inline)]
From: Jim Porter <jporterbugs <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; [PATCH] Support variable-width text in
 'visual-wrap-prefix-mode'
Date: Sun, 16 Jun 2024 19:56:44 -0700
[Message part 4 (text/plain, inline)]
(Note: I plan to merge this only after we cut the Emacs 30 release 
branch, since it seems a bit too substantial a change to sneak in right 
near the end. However, I think the patch is mostly done aside from one 
remaining issue, so any feedback is very welcome.)

'visual-wrap-prefix-mode' has one small issue: since the wrap prefix is 
just a string, the wrapped text may not line up for variable-width 
fonts. This is mainly in cases like so:

  * here is some text that
    got visually wrapped

If the "* " is variable-width, the second line will probably be indented 
wrong by a few pixels.

The attached patch adds a display spec in this case so that the text 
lines up perfectly. There's currently one problem though: I'm not sure 
how to regenerate the wrap prefix automatically if the face changes. 
It's not hard to handle for 'text-scale-adjust', but I don't know how to 
handle 'global-text-scale-adjust' (or other things that could change the 
face[1]).

Does anyone have any ideas for this part?

[1] There's 'after-setting-font-hook', but that doesn't cover everything 
either.
[0001-Add-support-for-variable-width-text-in-visual-wrap-p.patch (text/plain, attachment)]

This bug report was last modified 347 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.