summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2015-02-11 15:34:07 +1100
committerLars Magne Ingebrigtsen <larsi@gnus.org>2015-02-11 15:34:07 +1100
commite6929b0b8a3c4a10023f700c6121f9e0b182aa8a (patch)
treea8ee23ae56fa178192b5143ae084b6b48182ffb4
parentcbb6f138e661b11e03885f00041e6442ed12a6a5 (diff)
downloademacs-e6929b0b8a3c4a10023f700c6121f9e0b182aa8a.tar.gz
(shr-fill-line): Preserve background colours when indenting/folding.
-rw-r--r--lisp/ChangeLog1
-rw-r--r--lisp/net/shr.el16
2 files changed, 14 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7274c9da8f2..7ec017c94ec 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -2,6 +2,7 @@
* net/shr.el (shr-insert): Make sure the space inserted has the
right font (for width).
+ (shr-fill-line): Preserve background colours when indenting/folding.
2015-02-10 Lars Ingebrigtsen <larsi@gnus.org>
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index a4320853fd1..7a93c3a043c 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -550,7 +550,12 @@ size, and full-buffer size."
(point) 'shr-continuation-indentation))
start)
(put-text-property (point) (1+ (point)) 'shr-indentation nil)
- (shr-indent)
+ (let ((face (get-text-property (point) 'face))
+ (background-start (point)))
+ (shr-indent)
+ (when face
+ (put-text-property background-start (point) 'face
+ `,(shr-face-background face))))
(setq start (point))
(setq shr-indentation (or continuation shr-indentation))
(shr-vertical-motion shr-internal-width)
@@ -570,8 +575,13 @@ size, and full-buffer size."
;; Success; continue.
(when (= (preceding-char) ?\s)
(delete-char -1))
- (insert "\n")
- (shr-indent)
+ (let ((face (get-text-property (point) 'face))
+ (background-start (point)))
+ (insert "\n")
+ (shr-indent)
+ (when face
+ (put-text-property background-start (point) 'face
+ `,(shr-face-background face))))
(setq start (point))
(shr-vertical-motion shr-internal-width)
(when (looking-at " $")