From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#21012: 25.0.50; eww: last char of a line sometimes not fully visible Date: Fri, 10 Jul 2015 16:06:15 +0300 Message-ID: <83bnfkb1rs.fsf@gnu.org> References: <87twteh65g.fsf@web.de> <83d202v2m2.fsf@gnu.org> <87wpya5rey.fsf@web.de> <83a8v6ukbe.fsf@gnu.org> <834mlduyz8.fsf@gnu.org> <87egkh3xl3.fsf@web.de> <83pp40blcq.fsf@gnu.org> <874mlcgoka.fsf@web.de> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1436533645 11796 80.91.229.3 (10 Jul 2015 13:07:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 10 Jul 2015 13:07:25 +0000 (UTC) Cc: 21012@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 10 15:07:14 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZDY1J-0006E2-Vi for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Jul 2015 15:07:14 +0200 Original-Received: from localhost ([::1]:44624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDY1J-0003wp-7B for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Jul 2015 09:07:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDY1F-0003wk-AG for bug-gnu-emacs@gnu.org; Fri, 10 Jul 2015 09:07:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZDY18-0007O4-JR for bug-gnu-emacs@gnu.org; Fri, 10 Jul 2015 09:07:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDY18-0007Ns-Fa for bug-gnu-emacs@gnu.org; Fri, 10 Jul 2015 09:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZDY18-000838-3D for bug-gnu-emacs@gnu.org; Fri, 10 Jul 2015 09:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Jul 2015 13:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21012 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21012-submit@debbugs.gnu.org id=B21012.143653358930841 (code B ref 21012); Fri, 10 Jul 2015 13:07:02 +0000 Original-Received: (at 21012) by debbugs.gnu.org; 10 Jul 2015 13:06:29 +0000 Original-Received: from localhost ([127.0.0.1]:45967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZDY0a-00081L-Vl for submit@debbugs.gnu.org; Fri, 10 Jul 2015 09:06:29 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:50166) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZDY0Y-00080s-02 for 21012@debbugs.gnu.org; Fri, 10 Jul 2015 09:06:27 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0NR900300W2Q5500@a-mtaout22.012.net.il> for 21012@debbugs.gnu.org; Fri, 10 Jul 2015 16:06:19 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NR90024GWEGQS80@a-mtaout22.012.net.il>; Fri, 10 Jul 2015 16:06:16 +0300 (IDT) In-reply-to: <874mlcgoka.fsf@web.de> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:104888 Archived-At: > From: Michael Heerdegen > Cc: 21012@debbugs.gnu.org > Date: Fri, 10 Jul 2015 14:55:01 +0200 > > Eli Zaretskii 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))))))