Subject: Re: bug#31196: 27.0.50; shr sometimes doesn't break lines as it should

From: Eli Zaretskii <[email-masked]>
Date: Tue, 17 Apr 2018 21:25:35 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: [email-masked]
> 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?