GNU bug report logs - #31196
27.0.50; shr sometimes doesn't break lines as it should

Previous Next

Package: emacs;

Reported by: Lars Ingebrigtsen <larsi <at> gnus.org>

Date: Tue, 17 Apr 2018 14:53:01 UTC

Severity: minor

Tags: fixed

Found in version 27.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 31196 in the body.
You can then email your comments to 31196 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#31196; Package emacs. (Tue, 17 Apr 2018 14:53:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lars Ingebrigtsen <larsi <at> gnus.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 17 Apr 2018 14:53:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; shr sometimes doesn't break lines as it should
Date: Tue, 17 Apr 2018 16:52:31 +0200
With the following HTML, on this laptop with whatever font Emacs is
using right now, 80 characters wide, the following is one pixel too
wide:

<P>A young Quakers group in Nottingham, England released this 30-minute podcast of a silent meeting, complete with the ambient room sounds. John Cage would be proud. From <a href="https://www.theguardian.com/media/2018/apr/08/an-oasis-of-calm-quaker-groups-30-minutes-of-silence-podcast">The Guardian</a>:

The "m" in "room" extends too far.

I'm just posting this here to remind me to fix it; it'll be difficult
for anybody else to reproduce exactly.


In GNU Emacs 27.0.50 (build 7, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2018-04-15 built on corrigan
Repository revision: 1c16fbd1b281a46b07028ca78dbaab9a0ec6fd2f
Windowing system distributor 'The X.Org Foundation', version 11.0.11902000
System Description: Debian GNU/Linux 9 (stretch)


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31196; Package emacs. (Tue, 17 Apr 2018 17:04:02 GMT) Full text and rfc822 format available.

Message #8 received at 31196 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 31196 <at> debbugs.gnu.org
Subject: Re: bug#31196: 27.0.50; shr sometimes doesn't break lines as it should
Date: Tue, 17 Apr 2018 19:03:38 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> With the following HTML, on this laptop with whatever font Emacs is
> using right now, 80 characters wide, the following is one pixel too
> wide:

This is the problem, I think:

(- (window-body-width nil t)
   (* 2 (frame-char-width))
   (if (and (null shr-width)
            (not (shr--have-one-fringe-p)))
       (* (frame-char-width) 2)
     0))

This kludge is how shr computes how many pixels the window has
horizontally.

Surely there's a better way to find the practical "inner" width of a
window; i.e., the space where we can put text and stuff?  Does anybody
know?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31196; Package emacs. (Tue, 17 Apr 2018 17:07:01 GMT) Full text and rfc822 format available.

Message #11 received at 31196 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 31196 <at> debbugs.gnu.org
Subject: Re: bug#31196: 27.0.50; shr sometimes doesn't break lines as it should
Date: Tue, 17 Apr 2018 19:05:47 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Surely there's a better way to find the practical "inner" width of a
> window; i.e., the space where we can put text and stuff?  Does anybody
> know?

(If I decrease the width by 1 pixel, then things are filled correctly in
my test case.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31196; Package emacs. (Tue, 17 Apr 2018 17:36:02 GMT) Full text and rfc822 format available.

Message #14 received at 31196 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 31196 <at> debbugs.gnu.org
Subject: Re: bug#31196: 27.0.50; shr sometimes doesn't break lines as it should
Date: Tue, 17 Apr 2018 20:35:36 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Tue, 17 Apr 2018 19:03:38 +0200
> 
> (- (window-body-width nil t)
>    (* 2 (frame-char-width))
>    (if (and (null shr-width)
>             (not (shr--have-one-fringe-p)))
>        (* (frame-char-width) 2)
>      0))
> 
> This kludge is how shr computes how many pixels the window has
> horizontally.

Why is that a kludge?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31196; Package emacs. (Tue, 17 Apr 2018 17:44:01 GMT) Full text and rfc822 format available.

Message #17 received at 31196 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 31196 <at> debbugs.gnu.org
Subject: Re: bug#31196: 27.0.50; shr sometimes doesn't break lines as it should
Date: Tue, 17 Apr 2018 19:43:00 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Lars Ingebrigtsen <larsi <at> gnus.org>
>> Date: Tue, 17 Apr 2018 19:03:38 +0200
>> 
>> (- (window-body-width nil t)
>>    (* 2 (frame-char-width))
>>    (if (and (null shr-width)
>>             (not (shr--have-one-fringe-p)))
>>        (* (frame-char-width) 2)
>>      0))
>> 
>> This kludge is how shr computes how many pixels the window has
>> horizontally.
>
> Why is that a kludge?

Well, perhaps not a kludge, but very complicated for something you'd
think would be a metric that's more easily available.

And it seems to be 1 pixel wrong.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31196; Package emacs. (Tue, 17 Apr 2018 18:26:01 GMT) Full text and rfc822 format available.

Message #20 received at 31196 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 31196 <at> debbugs.gnu.org
Subject: Re: bug#31196: 27.0.50; shr sometimes doesn't break lines as it should
Date: Tue, 17 Apr 2018 21:25:35 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: 31196 <at> debbugs.gnu.org
> Date: Tue, 17 Apr 2018 19:43:00 +0200
> 
> >> (- (window-body-width nil t)
> >>    (* 2 (frame-char-width))
> >>    (if (and (null shr-width)
> >>             (not (shr--have-one-fringe-p)))
> >>        (* (frame-char-width) 2)
> >>      0))
> >> 
> >> This kludge is how shr computes how many pixels the window has
> >> horizontally.
> >
> > Why is that a kludge?
> 
> Well, perhaps not a kludge, but very complicated for something you'd
> think would be a metric that's more easily available.

The metric is indeed easily available: that's what window-body-width
returns.  But how can it know what will you do with the metric?  The
fact that you want to account for one or two fringes etc. is something
specific to the application, no?

> And it seems to be 1 pixel wrong.  :-)

Is it wrong, or are you counting pixels as in 0, 1, ... N, assuming
that the Nth pixel is still in the window?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31196; Package emacs. (Tue, 17 Apr 2018 18:34:02 GMT) Full text and rfc822 format available.

Message #23 received at 31196 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 31196 <at> debbugs.gnu.org
Subject: Re: bug#31196: 27.0.50; shr sometimes doesn't break lines as it should
Date: Tue, 17 Apr 2018 20:32:57 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> The metric is indeed easily available: that's what window-body-width
> returns.  But how can it know what will you do with the metric?  The
> fact that you want to account for one or two fringes etc. is something
> specific to the application, no?

Well, I think the common use case when you're asking how wide a window
is is that you're going to put something in that window and you want to
scale it to that window somehow.  Since the fringes aren't part of that
area, it's weird that you have to dig deeply into those obscure matters
to find the area, I think.

Perhaps `window-body-width' should have a parameter that makes it return
what you'd thing it should return?  (By "you" I mean "I", of course.)

>> And it seems to be 1 pixel wrong.  :-)
>
> Is it wrong, or are you counting pixels as in 0, 1, ... N, assuming
> that the Nth pixel is still in the window?

It's possible that there's an off-by-one error somewhere.

I'll just fix this by putting a -1 into the form and leave it be.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 01 May 2018 15:00:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 31196 <at> debbugs.gnu.org and Lars Ingebrigtsen <larsi <at> gnus.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 01 May 2018 15:00:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 30 May 2018 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 24 days ago.

Previous Next


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