bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21012: 25.0.50; eww: last char of a line sometimes not fully visible


From: Michael Heerdegen
Subject: bug#21012: 25.0.50; eww: last char of a line sometimes not fully visible
Date: Wed, 08 Jul 2015 22:24:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]