diff lisp/gnus/shr.el @ 111072:a7fee19797df

message.el (message-fix-before-sending): Change options when sending non-printable characters. shr.el (shr-add-font): Don't put the font properties on the newline or the indentation.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Thu, 21 Oct 2010 01:49:12 +0000
parents e36c65ac23bf
children 647c0a15da32
line wrap: on
line diff
--- a/lisp/gnus/shr.el	Thu Oct 21 01:28:34 2010 +0000
+++ b/lisp/gnus/shr.el	Thu Oct 21 01:49:12 2010 +0000
@@ -318,9 +318,20 @@
     (dolist (type types)
       (shr-add-font (or shr-start (point)) (point) type))))
 
+;; Add an overlay in the region, but avoid putting the font properties
+;; on blank text at the start of the line, and the newline at the end,
+;; to avoid ugliness.
 (defun shr-add-font (start end type)
-  (let ((overlay (make-overlay start end)))
-    (overlay-put overlay 'face type)))
+  (save-excursion
+    (goto-char start)
+    (while (< (point) end)
+      (when (bolp)
+	(skip-chars-forward " "))
+      (let ((overlay (make-overlay (point) (min (line-end-position) end))))
+	(overlay-put overlay 'face type))
+      (if (< (line-end-position) end)
+	  (forward-line 1)
+	(goto-char end)))))
 
 (defun shr-browse-url ()
   "Browse the URL under point."