emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master c7b112b 1/2: Clarify shr width computation


From: Lars Ingebrigtsen
Subject: master c7b112b 1/2: Clarify shr width computation
Date: Fri, 17 Jul 2020 09:45:37 -0400 (EDT)

branch: master
commit c7b112b13fd93b83b3a2b4046c3ffa19cad3d18a
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Clarify shr width computation
    
    * lisp/net/shr.el (shr-insert-document): Clarify width
    computation: shr-width was checked again in the `else' part where
    we already knew it was nil.
---
 lisp/net/shr.el | 43 +++++++++++++++++++++----------------------
 1 file changed, 21 insertions(+), 22 deletions(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index b19df8c..daaed3b 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -267,28 +267,27 @@ DOM should be a parse tree as generated by
        (shr-table-separator-pixel-width (shr-string-pixel-width "-"))
        (shr-internal-bullet (cons shr-bullet
                                   (shr-string-pixel-width shr-bullet)))
-       (shr-internal-width (or (and shr-width
-                                    (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-body-width) 1
-                                       (if (and (null shr-width)
-                                                (not (shr--have-one-fringe-p)))
-                                           0
-                                         1))
-                                 (- (window-body-width nil t)
-                                     (* 2 (frame-char-width))
-                                     (if (and (null shr-width)
-                                              (not (shr--have-one-fringe-p)))
-                                         (* (frame-char-width) 2)
-                                       0)
-                                     1))))
+       (shr-internal-width
+         (if shr-width
+             ;; Specified width; use it.
+            (if (not shr-use-fonts)
+                shr-width
+              (* shr-width (frame-char-width)))
+           ;; Compute the width based on the window 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-body-width) 1
+                  (if (shr--have-one-fringe-p)
+                      1
+                    0))
+            (- (window-body-width nil t)
+                (* 2 (frame-char-width))
+                (if (shr--have-one-fringe-p)
+                    0
+                  (* (frame-char-width) 2))
+                1))))
         (max-specpdl-size max-specpdl-size)
         bidi-display-reordering)
     ;; If the window was hscrolled for some reason, shr-fill-lines



reply via email to

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