GNU bug report logs -
#21012
25.0.50; eww: last char of a line sometimes not fully visible
Previous Next
Full log
Message #11 received at 21012 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> Is the partially-visible character always the last character on that
> line, before the hard newline?
From what I saw - yes, but I'm not if "always" is correct.
> > (- (window-pixel-width) (* (frame-fringe-width) 2))
> >
> > is not the available width for text, it is a larger value including
> > scroll bars etc.
>
> Do you understand why the value of frame-fringe-width is multiplied by
> 2?
I guess because the window is assumed to have two fringes.
> I think that using window-body-width is indeed better here. It will,
> for example, account for display margins.
Yes, I think the author of shr just tried to reinvent it.
> > --8<---------------cut here---------------start------------->8---
> > (defun shr-vertical-motion (column)
> > (if (not shr-use-fonts)
> > (move-to-column column)
> > (unless (eolp)
> > (forward-char 1))
> > (vertical-motion (cons (/ column (frame-char-width)) 0)) ; <-- here
> > (unless (eolp)
> > (forward-char 1))))
> > --8<---------------cut here---------------end--------------->8---
> >
> > This function is used, among other places, to decide where to break
> > lines in `shr-fill-line'.
> >
> > Probably (/ column (frame-char-width)) can be too large if you are
> > unlucky.
>
> Sorry, I don't follow. Can you elaborate on when this could happen?
Note that in the shr-use-fonts -> t case, COLUMN is in pixels.
(/ column (frame-char-width))
is IMO an estimated value of "real" columns to advance. But if there
are many wide characters, this can be too large.
> > For testing I tried with this version:
> >
> > --8<---------------cut here---------------start------------->8---
> > (defun shr-vertical-motion (column)
> > (if (not shr-use-fonts)
> > (move-to-column column)
> > (unless (eolp)
> > (forward-char 1))
> > (end-of-visual-line)))
> > --8<---------------cut here---------------end--------------->8---
> >
> > This seems to fix this issue (together with the first change),
>
> I don't see how this could be right, unless you only tested it with
> text that is rendered using a single font. move-to-column goes to the
> [...]
I think you looked at the wrong `if' branch...? What I changed was to
use `end-of-visual-line', which I hope is more accurate than
(vertical-motion (cons (/ column (frame-char-width)) 0))
for finding the right point for breaking the line.
Michael.
This bug report was last modified 9 years and 290 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.