GNU bug report logs -
#21012
25.0.50; eww: last char of a line sometimes not fully visible
Previous Next
Full log
Message #41 received at 21012 <at> debbugs.gnu.org (full text, mbox):
> From: Michael Heerdegen <michael_heerdegen <at> web.de>
> Cc: 21012 <at> debbugs.gnu.org
> Date: Fri, 10 Jul 2015 14:55:01 +0200
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > The problem is that functions we have that can tell if that happens
> > require the relevant portion of the buffer to be displayed in some
> > window, so I think shr.el cannot use them.
>
> 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
@@ -549,20 +578,42 @@
(shr-fill-line)))
(goto-char (point-max)))))
-(defun shr-vertical-motion (column)
+(defun shr-vertical-motion (column win-width)
(if (not shr-use-fonts)
(move-to-column column)
(unless (eolp)
(forward-char 1))
- (vertical-motion (cons (/ column (frame-char-width)) 0))
- (unless (eolp)
- (forward-char 1))))
+ (let ((orig-y (cdr (nth 2 (posn-at-point)))))
+ (vertical-motion (cons (/ column (frame-char-width)) 0))
+ ;; If vertical-motion puts us on the next screen line, back up.
+ ;; This can happen when the character at the goal column is too
+ ;; wide to fit on the line.
+ (if (> (cdr (nth 2 (posn-at-point))) orig-y)
+ (backward-char 1))
+ (unless (eolp)
+ (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)))))))
(defun shr-fill-line ()
(let ((shr-indentation (get-text-property (point) 'shr-indentation))
(continuation (get-text-property
(point) 'shr-continuation-indentation))
- start)
+ start win-width)
+ (when shr-use-fonts
+ (setq win-width (window-body-width nil t))
+ ;; When we are filling to the window width, and the user
+ ;; disabled the fringes, an additional column is reserved for
+ ;; the continuation glyph, so we need to adjust the effective
+ ;; window-width for that.
+ (if (and (null shr-width)
+ (or (zerop (fringe-columns 'left))
+ (zerop (fringe-columns 'right))))
+ (setq win-width (- win-width (frame-char-width)))))
(put-text-property (point) (1+ (point)) 'shr-indentation nil)
(let ((face (get-text-property (point) 'face))
(background-start (point)))
@@ -572,7 +623,7 @@
`,(shr-face-background face))))
(setq start (point))
(setq shr-indentation (or continuation shr-indentation))
- (shr-vertical-motion shr-internal-width)
+ (shr-vertical-motion shr-internal-width win-width)
(when (looking-at " $")
(delete-region (point) (line-end-position)))
(while (not (eolp))
@@ -597,7 +648,7 @@
(put-text-property background-start (point) 'face
`,(shr-face-background face))))
(setq start (point))
- (shr-vertical-motion shr-internal-width)
+ (shr-vertical-motion shr-internal-width win-width)
(when (looking-at " $")
(delete-region (point) (line-end-position))))))
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.