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.
This commit is contained in:
Lars Ingebrigtsen 2020-07-17 15:30:29 +02:00
parent bcb58180c7
commit c7b112b13f

View file

@ -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