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

From: Michael Heerdegen <[email-masked]>
Date: Fri, 10 Jul 2015 16:16:00 +0200

Eli Zaretskii <[email-masked]> writes:

> > FWIW, the whole thing is already displayed
>
> Then please try this change and see if it gives good results:
>
> --- lisp/net/shr.el~0	2015-05-10 07:23:55 +0300
> +++ lisp/net/shr.el	2015-07-09 19:24:11 +0300

Unfortunately it doesn't work.  Rendering now fails with an error:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  >(nil nil)
  (if (> (cdr (nth 2 (posn-at-point))) orig-y) (backward-char 1))
  (let ((orig-y (cdr (nth 2 (posn-at-point))))) (vertical-motion (cons (/ column (frame-char-width)) 0)) (if (> (cdr (nth 2 (posn-at-point))) orig-y) (backward-char 1)) (if (eolp) nil (let* ((posn (posn-at-point)) (ch-x (car (nth 2 posn))) (ch-width (car (nth 9 posn))) (ch-pos (nth 1 posn))) (if (and (natnump ch-pos) (<= (+ ch-x ch-width) win-width)) (forward-char 1)))))
  (if (not shr-use-fonts) (move-to-column column) (if (eolp) nil (forward-char 1)) (let ((orig-y (cdr (nth 2 (posn-at-point))))) (vertical-motion (cons (/ column (frame-char-width)) 0)) (if (> (cdr (nth 2 (posn-at-point))) orig-y) (backward-char 1)) (if (eolp) nil (let* ((posn (posn-at-point)) (ch-x (car (nth 2 posn))) (ch-width (car (nth 9 posn))) (ch-pos (nth 1 posn))) (if (and (natnump ch-pos) (<= (+ ch-x ch-width) win-width)) (forward-char 1))))))
  shr-vertical-motion(1250 1247)
  [...]
  shr-fill-line()
  
because `posn-at-point' returns nil as soon as point moves past
`window-end'.  I can see that with the

  (advice-add 'shr-fill-line :after (lambda (&rest _) (sit-for .5)))

advice active.

Obviously it's not as simple as I thought, not the whole buffer is
"already displayed".  My bad.

Michael.