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: Sat, 03 Oct 2015 10:08:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

> Fine with me, please go ahead.

I thought it would be easier to send you the contents of commit buffer
in magit - it includes even more information than git format-patch -1.

Here it is:

master d72b05282033821884cfaef59f278a2bf6af33b6
Author:     Eli Zaretskii <eliz@gnu.org>
AuthorDate: Thu Jul 9 05:38:29 2015 +0300
Commit:       Michael Heerdegen <michael_heerdegen@web.de>
CommitDate:   Sat Oct 3 09:43:03 2015 +0200

Parent:     e160525 Adapt to new prettify-symbols-unprettify-at-point default
Merged:     master
Containing: master
Follows:    emacs-24.5-rc3-fixed (6094)

shr: fix too long lines in rendered buffers (Bug#21012)

* lisp/net/shr.el (shr-insert-document, shr-fill-text):
Correct calculation of available width.
(shr-find-fill-point): Don't overflow window edge if shr-kinsoku-shorten
is nil.

1 file changed, 42 insertions(+), 8 deletions(-)
lisp/net/shr.el | 50 ++++++++++++++++++++++++++++++++++++++++++--------

modified   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,

Does that all make sense and play by the rules (commit message)?

I specified you as the author (since all but some chars is from you),
and specified the date you had sent the patch as commit --date (aka
"author date").

Oh, and I don't know anything about `shr-kinsoku-shorten', I hope what I
wrote makes sense.

If you are agreed with everything, I plan to pull --rebase, and push.

Thanks for your review in advance.


Regards,

Michael.

reply via email to

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