[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master a2d98c5: Use pixel-fill-width in shr.el
From: |
Lars Ingebrigtsen |
Subject: |
master a2d98c5: Use pixel-fill-width in shr.el |
Date: |
Tue, 30 Nov 2021 10:54:41 -0500 (EST) |
branch: master
commit a2d98c54f71a8f1c0a1dee32dfcd6c36e5d7c107
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Use pixel-fill-width in shr.el
* lisp/net/shr.el (shr--window-width): Factor out into own function.
(shr-insert-document): Use it.
(shr-fill-text): Ditto.
---
lisp/net/shr.el | 40 ++++++++++++++--------------------------
1 file changed, 14 insertions(+), 26 deletions(-)
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 5d38a7e..d4c7aaf 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -312,6 +312,18 @@ and other things:
(or (not (zerop (fringe-columns 'right)))
(not (zerop (fringe-columns 'left))))))
+(defun shr--window-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))
+ (pixel-fill-width)))
+
;;;###autoload
(defun shr-insert-document (dom)
"Render the parsed document DOM into the current buffer.
@@ -333,21 +345,7 @@ DOM should be a parse tree as generated by
(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))))
+ (shr--window-width)))
(max-specpdl-size max-specpdl-size)
;; `bidi-display-reordering' is supposed to be only used for
;; debugging purposes, but Shr's naïve filling algorithm
@@ -626,17 +624,7 @@ size, and full-buffer size."
(with-temp-buffer
(let ((shr-indentation 0)
(shr-start nil)
- (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
- ;; to usurp one column for the
- ;; continuation glyph.
- (if (and (null shr-width)
- (not (shr--have-one-fringe-p)))
- (* (frame-char-width) 2)
- 0))))
+ (shr-internal-width (shr--window-width)))
(shr-insert text)
(shr-fill-lines (point-min) (point-max))
(buffer-string)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master a2d98c5: Use pixel-fill-width in shr.el,
Lars Ingebrigtsen <=