GNU bug report logs -
#72485
Support 'visual-wrap-prefix-mode' in SHR/EWW
Previous Next
Reported by: Jim Porter <jporterbugs <at> gmail.com>
Date: Tue, 6 Aug 2024 03:49:02 UTC
Severity: normal
Done: Jim Porter <jporterbugs <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 72485 in the body.
You can then email your comments to 72485 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72485
; Package
emacs
.
(Tue, 06 Aug 2024 03:49:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Jim Porter <jporterbugs <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 06 Aug 2024 03:49:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
This patch is an extension of bug#71605, and the first place to
explicitly use the new variable-pitch support for
'visual-wrap-prefix-mode'. While implementing this, I found two small
bugs in the new 'visual-wrap-prefix-mode' code:
1. When setting the min-width for the first line prefix, we should use
'add-display-text-property' so as not to clobber other display properties.
2. My attempts to be "helpful" by special-casing wrap-prefixes of all
spaces ended up just interfering with more complex cases (like SHR), so
I removed it. The code is now simpler (one fewer condition) and just
works more smoothly overall.
There's one limitation to this patch though: since SHR uses absolute
pixel-widths for indenting internally, things can look mis-indented if
you scale the text in the buffer. However, SHR has exactly the same
issue when *not* using 'visual-wrap-prefix-mode', so it's really just a
more-general bug in SHR. (It'd be nice to fix that, but I'd have to get
a better understanding of how indentation and <table> elements interact.)
Attached is a test HTML page that shows off the indentation. You can see
the results by running:
emacs -Q --eval '(progn (setq shr-fill-text nil) (eww "test.html"))'
(And also compare to the default behavior where 'shr-fill-text' is non-nil.)
[0001-Improve-SHR-EWW-support-for-visual-wrap-prefix-mode.patch (text/plain, attachment)]
[test.html (text/html, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72485
; Package
emacs
.
(Sat, 17 Aug 2024 08:57:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 72485 <at> debbugs.gnu.org (full text, mbox):
> Date: Mon, 5 Aug 2024 20:47:52 -0700
> From: Jim Porter <jporterbugs <at> gmail.com>
>
> This patch is an extension of bug#71605, and the first place to
> explicitly use the new variable-pitch support for
> 'visual-wrap-prefix-mode'. While implementing this, I found two small
> bugs in the new 'visual-wrap-prefix-mode' code:
>
> 1. When setting the min-width for the first line prefix, we should use
> 'add-display-text-property' so as not to clobber other display properties.
>
> 2. My attempts to be "helpful" by special-casing wrap-prefixes of all
> spaces ended up just interfering with more complex cases (like SHR), so
> I removed it. The code is now simpler (one fewer condition) and just
> works more smoothly overall.
>
> There's one limitation to this patch though: since SHR uses absolute
> pixel-widths for indenting internally, things can look mis-indented if
> you scale the text in the buffer. However, SHR has exactly the same
> issue when *not* using 'visual-wrap-prefix-mode', so it's really just a
> more-general bug in SHR. (It'd be nice to fix that, but I'd have to get
> a better understanding of how indentation and <table> elements interact.)
Thanks. This lacks a NEWS entry, but other than that, feel fee to
install on master when ready.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72485
; Package
emacs
.
(Sun, 18 Aug 2024 00:32:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 72485 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 8/17/2024 1:55 AM, Eli Zaretskii wrote:
>> Date: Mon, 5 Aug 2024 20:47:52 -0700
>> From: Jim Porter <jporterbugs <at> gmail.com>
>>
>> There's one limitation to this patch though: since SHR uses absolute
>> pixel-widths for indenting internally, things can look mis-indented if
>> you scale the text in the buffer. However, SHR has exactly the same
>> issue when *not* using 'visual-wrap-prefix-mode', so it's really just a
>> more-general bug in SHR. (It'd be nice to fix that, but I'd have to get
>> a better understanding of how indentation and <table> elements interact.)
>
> Thanks. This lacks a NEWS entry, but other than that, feel fee to
> install on master when ready.
Thanks for taking a look. I've added a NEWS entry (see attached). I also
improved the implementation a bit, so the above-mentioned limitation is
no longer a problem. Now, SHR/EWW will indent things properly even when
using 'text-scale-adjust'.
(The additional changes aren't major, so I'll probably merge this in a
day or two once I've had time to sleep on it.)
[0001-Improve-SHR-EWW-support-for-visual-wrap-prefix-mode.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72485
; Package
emacs
.
(Sun, 18 Aug 2024 04:51:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 72485 <at> debbugs.gnu.org (full text, mbox):
> Date: Sat, 17 Aug 2024 17:30:10 -0700
> Cc: 72485 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs <at> gmail.com>
>
> +** EWW
> +
> +---
> +*** EWW now enables 'visual-wrap-prefix-mode' when 'shr-fill-text' is nil.
> +This improves the display of multiline, indented text, such as block
> +quotes or (un)ordered lists. Now, the wrapped lines of indented text
> +will line up visually with the first line.
I'm not sure many users know about shr-fill-text, including that its
default is non-nil. So I think this NEWS entry should say something
about that, otherwise this text might cause incorrect user
expectations.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72485
; Package
emacs
.
(Sun, 18 Aug 2024 06:15:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 72485 <at> debbugs.gnu.org (full text, mbox):
On 8/17/2024 9:49 PM, Eli Zaretskii wrote:
> I'm not sure many users know about shr-fill-text, including that its
> default is non-nil. So I think this NEWS entry should say something
> about that, otherwise this text might cause incorrect user
> expectations.
How does this sound?
----------------------------------------
*** EWW now enables 'visual-wrap-prefix-mode' when 'shr-fill-text' is nil.
Previously, when 'shr-fill-text' was nil, EWW would use
'visual-line-mode' to wrap paragraphs instead of inserting newline
characters. Now, EWW additionally enables 'visual-wrap-prefix-mode' in
this case. This improves the display of multiline, indented text, such
as block quotes or (un)ordered lists.
----------------------------------------
I also notice that 'shr-fill-text' is new in Emacs 30, but doesn't have
a NEWS entry in that release. Should I add a mention of it to the Emacs
30 NEWS as well? (I don't see any harm in reiterating what
'shr-fill-text' does in the Emacs 31 NEWS as well though.)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72485
; Package
emacs
.
(Sun, 18 Aug 2024 09:22:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 72485 <at> debbugs.gnu.org (full text, mbox):
> Date: Sat, 17 Aug 2024 23:13:00 -0700
> Cc: 72485 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs <at> gmail.com>
>
> On 8/17/2024 9:49 PM, Eli Zaretskii wrote:
> > I'm not sure many users know about shr-fill-text, including that its
> > default is non-nil. So I think this NEWS entry should say something
> > about that, otherwise this text might cause incorrect user
> > expectations.
>
> How does this sound?
>
> ----------------------------------------
>
> *** EWW now enables 'visual-wrap-prefix-mode' when 'shr-fill-text' is nil.
> Previously, when 'shr-fill-text' was nil, EWW would use
> 'visual-line-mode' to wrap paragraphs instead of inserting newline
> characters. Now, EWW additionally enables 'visual-wrap-prefix-mode' in
> this case. This improves the display of multiline, indented text, such
> as block quotes or (un)ordered lists.
It still doesn't say that shr-fill-text is non-nil by default.
> I also notice that 'shr-fill-text' is new in Emacs 30, but doesn't have
> a NEWS entry in that release. Should I add a mention of it to the Emacs
> 30 NEWS as well?
Yes, please do.
> (I don't see any harm in reiterating what 'shr-fill-text' does in
> the Emacs 31 NEWS as well though.)
I don't see a reason to reiterate that.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72485
; Package
emacs
.
(Sun, 18 Aug 2024 17:00:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 72485 <at> debbugs.gnu.org (full text, mbox):
On 8/18/2024 2:20 AM, Eli Zaretskii wrote:
> It still doesn't say that shr-fill-text is non-nil by default.
>
>> I also notice that 'shr-fill-text' is new in Emacs 30, but doesn't have
>> a NEWS entry in that release. Should I add a mention of it to the Emacs
>> 30 NEWS as well?
>
> Yes, please do.
How about this?
---------- For Emacs 30 ----------
*** New option 'shr-fill-text'.
When non-nil (the default), SHR will insert newlines in text to wrap it.
If customized to nil, SHR will leave the text as-is; in that case, EWW
will automatically enable 'visual-line-mode' to visually wrap the text
when displaying a page.
---------- For Emacs 31 ----------
*** EWW now enables 'visual-wrap-prefix-mode' when 'shr-fill-text' is nil.
When 'shr-fill-text' is customized to nil, EWW now enables
'visual-wrap-prefix-mode' when rendering in addition to
'visual-line-mode'. This improves the display of multiline, indented
text, such as block quotes or (un)ordered lists.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72485
; Package
emacs
.
(Sun, 18 Aug 2024 18:14:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 72485 <at> debbugs.gnu.org (full text, mbox):
> Date: Sun, 18 Aug 2024 09:58:07 -0700
> Cc: 72485 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs <at> gmail.com>
>
> *** New option 'shr-fill-text'.
> When non-nil (the default), SHR will insert newlines in text to wrap it.
> If customized to nil, SHR will leave the text as-is; in that case, EWW
> will automatically enable 'visual-line-mode' to visually wrap the text
> when displaying a page.
Inserting newlines is not the important part of this variable's
effect. The important part is filling the text, and shr does that
with fixed-pitch and variable-pitch fonts alike. The NEWS entry
should describe this important part.
> *** EWW now enables 'visual-wrap-prefix-mode' when 'shr-fill-text' is nil.
> When 'shr-fill-text' is customized to nil, EWW now enables
> 'visual-wrap-prefix-mode' when rendering in addition to
> 'visual-line-mode'. This improves the display of multiline, indented
> text, such as block quotes or (un)ordered lists.
I evidently fail to explain myself, so let me just propose an entry
as I envisioned it:
*** EWW now enables 'visual-wrap-prefix-mode' when 'shr-fill-text' is nil.
By default, 'shr-fill-text' is t, and EWW fills the text according to
the width of the window. If you customize 'shr-fill-text' to nil,
EWW will now automatically turn on 'visual-wrap-prefix-mode' in
addition to 'visual-line-mode', so that long lines are wrapped at
word boundaries near window edge and the continuation lines are
indented using prefixes computed from surrounding context.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72485
; Package
emacs
.
(Sun, 18 Aug 2024 18:31:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 72485 <at> debbugs.gnu.org (full text, mbox):
On 8/18/2024 11:12 AM, Eli Zaretskii wrote:
> *** EWW now enables 'visual-wrap-prefix-mode' when 'shr-fill-text' is nil.
> By default, 'shr-fill-text' is t, and EWW fills the text according to
> the width of the window. If you customize 'shr-fill-text' to nil,
> EWW will now automatically turn on 'visual-wrap-prefix-mode' in
> addition to 'visual-line-mode', so that long lines are wrapped at
> word boundaries near window edge and the continuation lines are
> indented using prefixes computed from surrounding context.
That seems good to me, so I'll just use that as-is for Emacs 31. How
about this for the release branch?
*** New option 'shr-fill-text'.
When 'shr-fill-text' is non-nil (the default), SHR will fill the text
according to the width of the window. If you customize it to nil, SHR
will leave the text as-is; in that case, EWW will automatically enable
'visual-line-mode' when displaying a page so that long lines are
visually wrapped at word boundaries.
(If you think this makes the Emacs 31 NEWS entry partially redundant, I
can try to trim that one down to only discuss the new additions, but I
don't mind either way.)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72485
; Package
emacs
.
(Sun, 18 Aug 2024 18:55:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 72485 <at> debbugs.gnu.org (full text, mbox):
> Date: Sun, 18 Aug 2024 11:28:40 -0700
> Cc: 72485 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs <at> gmail.com>
>
> On 8/18/2024 11:12 AM, Eli Zaretskii wrote:
> > *** EWW now enables 'visual-wrap-prefix-mode' when 'shr-fill-text' is nil.
> > By default, 'shr-fill-text' is t, and EWW fills the text according to
> > the width of the window. If you customize 'shr-fill-text' to nil,
> > EWW will now automatically turn on 'visual-wrap-prefix-mode' in
> > addition to 'visual-line-mode', so that long lines are wrapped at
> > word boundaries near window edge and the continuation lines are
> > indented using prefixes computed from surrounding context.
>
> That seems good to me, so I'll just use that as-is for Emacs 31. How
> about this for the release branch?
>
>
> *** New option 'shr-fill-text'.
> When 'shr-fill-text' is non-nil (the default), SHR will fill the text
> according to the width of the window. If you customize it to nil, SHR
> will leave the text as-is; in that case, EWW will automatically enable
> 'visual-line-mode' when displaying a page so that long lines are
> visually wrapped at word boundaries.
LGTM, thanks.
> (If you think this makes the Emacs 31 NEWS entry partially redundant, I
> can try to trim that one down to only discuss the new additions, but I
> don't mind either way.)
I see no reason to trim it.
Reply sent
to
Jim Porter <jporterbugs <at> gmail.com>
:
You have taken responsibility.
(Sun, 18 Aug 2024 23:13:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Jim Porter <jporterbugs <at> gmail.com>
:
bug acknowledged by developer.
(Sun, 18 Aug 2024 23:13:02 GMT)
Full text and
rfc822 format available.
Message #37 received at 72485-done <at> debbugs.gnu.org (full text, mbox):
On 8/18/2024 11:53 AM, Eli Zaretskii wrote:
> LGTM, thanks.
>
>> (If you think this makes the Emacs 31 NEWS entry partially redundant, I
>> can try to trim that one down to only discuss the new additions, but I
>> don't mind either way.)
>
> I see no reason to trim it.
Thanks. Merged the NEWS update to the release branch as b54e8b3741b, and
the main patch to the master branch as a876c4d7a17. Closing this bug now.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 16 Sep 2024 11:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 335 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.