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

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Wed, 8 Jul 2015 18:11:02 UTC

Severity: minor

Found in version 25.0.50

Done: Michael Heerdegen <michael_heerdegen <at> web.de>

Bug is archived. No further changes may be made.

Full log


Message #62 received at 21012 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 21012 <at> debbugs.gnu.org
Subject: Re: bug#21012: 25.0.50;
 eww: last char of a line sometimes not fully visible
Date: Sat, 11 Jul 2015 14:02:42 +0200
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

> It should be possible, in principle, to write something similar to
> posn-at-point that would not depend on the text being visible, or
> rewrite posn-at-point to free it from this limitation, but we don't
> have such a function at this time.  Maybe we should.

Of course would that be useful, not only for this issue.  But I guess it
would be a lot of work.

I try now what you suggested, subtracting one more column width when
calculating `shr-internal-width'.  I.e., I subtract one more
`frame-char-width' now.  Looks good so far.  I'll use it for some time
and tell you what I think.

So, here is what I'm testing, based on your first patch:

[shr-02.patch (text/x-diff, inline)]
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -222,10 +222,29 @@ DOM should be a parse tree as generated by
 				     (if (not shr-use-fonts)
 					 shr-width
 				       (* shr-width (frame-char-width))))
+                                ;; We need to adjust the available
+                                ;; width for when the user disables
+                                ;; the fringes, which will cause the
+                                ;; display engine usurp one column for
+                                ;; the continuation glyph.
 				(if (not shr-use-fonts)
-				    (- (window-width) 2)
-				  (- (window-pixel-width)
-				     (* (frame-fringe-width) 2))))))
+				    (- (window-body-width) 1
+                                       (if (and (null shr-width)
+                                                (or (zerop
+                                                     (fringe-columns 'right))
+                                                    (zerop
+                                                     (fringe-columns 'left))))
+                                           0
+                                         1))
+				  (- (window-body-width nil t)
+                                     (* 2 (frame-char-width))
+                                     (if (and (null shr-width)
+                                              (or (zerop
+                                                   (fringe-columns 'right))
+                                                  (zerop
+                                                   (fringe-columns 'left))))
+                                         (* (frame-char-width) 2)
+                                       0))))))
     (shr-descend dom)
     (shr-fill-lines start (point))
     (shr-remove-trailing-whitespace start (point))
@@ -439,8 +458,18 @@ size, and full-buffer size."
     (with-temp-buffer
       (let ((shr-indentation 0)
 	    (shr-start nil)
-	    (shr-internal-width (- (window-pixel-width)
-				   (* (frame-fringe-width) 2))))
+	    (shr-internal-width (- (window-body-width nil t)
+                                   (* 2 (frame-char-width))
+                                   ;; Adjust the window width for when
+                                   ;; the user disables the fringes,
+                                   ;; which causes the display engine
+                                   ;; usurp one coplumn for the
+                                   ;; continuation glyph.
+                                   (if (and (null shr-width)
+                                            (or (zerop (fringe-columns 'right))
+                                                (zerop (fringe-columns 'left))))
+                                       (* (frame-char-width) 2)
+                                     0))))
 	(shr-insert text)
 	(buffer-string)))))
 
@@ -620,7 +649,9 @@ size, and full-buffer size."
 	;; There's no breakable point, so we give it up.
 	(let (found)
 	  (goto-char bp)
-	  (unless shr-kinsoku-shorten
+          ;; Don't overflow the window edge, even if
+          ;; shr-kinsoku-shorten is nil.
+	  (unless (or shr-kinsoku-shorten (null shr-width))
 	    (while (setq found (re-search-forward
 				"\\(\\c>\\)\\| \\|\\c<\\|\\c|"
 				(line-end-position) 'move)))
@@ -632,9 +663,12 @@ size, and full-buffer size."
        ;; Don't put kinsoku-bol characters at the beginning of a line,
        ;; or kinsoku-eol characters at the end of a line.
        (cond
-	(shr-kinsoku-shorten
+        ;; Don't overflow the window edge, even if shr-kinsoku-shorten
+        ;; is nil.
+	((or shr-kinsoku-shorten (null shr-width))
 	 (while (and (not (memq (preceding-char) (list ?\C-@ ?\n ? )))
-		     (shr-char-kinsoku-eol-p (preceding-char)))
+		     (or (shr-char-kinsoku-eol-p (preceding-char))
+                         (shr-char-kinsoku-bol-p (following-char))))
 	   (backward-char 1))
 	 (when (setq failed (<= (point) start))
 	   ;; There's no breakable point that doesn't violate kinsoku,
[Message part 3 (text/plain, inline)]

Thanks,

Michael.

This bug report was last modified 9 years and 291 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.