emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master e6929b0: (shr-fill-line): Preserve background colou


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master e6929b0: (shr-fill-line): Preserve background colours when indenting/folding.
Date: Wed, 11 Feb 2015 04:34:16 +0000

branch: master
commit e6929b0b8a3c4a10023f700c6121f9e0b182aa8a
Author: Lars Magne Ingebrigtsen <address@hidden>
Commit: Lars Magne Ingebrigtsen <address@hidden>

    (shr-fill-line): Preserve background colours when indenting/folding.
---
 lisp/ChangeLog  |    1 +
 lisp/net/shr.el |   16 +++++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7274c9d..7ec017c 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  <address@hidden>
 
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index a432085..7a93c3a 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 " $")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]