[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] shr-fontified dfb4c4f 2/4: Use the correct width for layin
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] shr-fontified dfb4c4f 2/4: Use the correct width for laying out HTML |
Date: |
Fri, 30 Jan 2015 05:46:16 +0000 |
branch: shr-fontified
commit dfb4c4f49c95608f44ade86e9b0a8ea90522d818
Author: Lars Magne Ingebrigtsen <address@hidden>
Commit: Lars Magne Ingebrigtsen <address@hidden>
Use the correct width for laying out HTML
* lisp/net/shr.el (shr-insert-document): Subtract the fringe width to
get the real area we have to play with.
---
lisp/ChangeLog | 3 +++
lisp/net/shr.el | 9 +++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 18914ce..2a7e415 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
2015-01-30 Lars Ingebrigtsen <address@hidden>
+ * net/shr.el (shr-insert-document): Subtract the fringe width to
+ get the real area we have to play with.
+
* net/eww.el (eww-display-html): Use shr's body renderer. They
were identical.
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 6328796..318f487 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -207,7 +207,9 @@ DOM should be a parse tree as generated by
(shr-base nil)
(shr-depth 0)
(shr-warning nil)
- (shr-internal-width (or shr-width (- (window-pixel-width) 40))))
+ (shr-internal-width (or shr-width
+ (- (window-pixel-width)
+ (* (frame-fringe-width) 2)))))
(shr-descend dom)
(shr-remove-trailing-whitespace start (point))
(when shr-warning
@@ -421,7 +423,8 @@ size, and full-buffer size."
(let ((shr-indentation 0)
(shr-state nil)
(shr-start nil)
- (shr-internal-width (- (window-pixel-width) 10)))
+ (shr-internal-width (- (window-pixel-width)
+ (* (frame-fringe-width) 2))))
(shr-insert text)
(buffer-string)))))
@@ -536,6 +539,8 @@ size, and full-buffer size."
;; fill point.
(setq i (+ i (- end (point)))
this-width 0)
+ (when (= (preceding-char) ?\s)
+ (delete-char -1))
(insert "\n")))))))
(defun shr-glyph-widths (start end)