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.
This commit is contained in:
parent
10d371e4fa
commit
a2d98c54f7
1 changed files with 14 additions and 26 deletions
|
@ -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)))))
|
||||
|
|
Loading…
Add table
Reference in a new issue