[gnus git] branch master updated: m0-1-45-ga6e0787 =1= shr image zoom fixups

Lars Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  a6e0787ddafd545a57b57d97725a26b2fcf26ab7 (commit)
      from  5056ea6daee76116bc35aca791d25c1754005c97 (commit)


- Log -----------------------------------------------------------------
commit a6e0787ddafd545a57b57d97725a26b2fcf26ab7
Author: Lars Ingebrigtsen <[email protected]>
Date:   Thu Feb 2 10:32:42 2012 +0100

    shr image zoom fixups
    
    * shr.el (shr-put-image): Remove underlines from sliced images.
    (shr-zoom-image): Compute the region to be replaced more correctly.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7255fe9..d94f352 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-02  Lars Ingebrigtsen  <[email protected]>
+
+	* shr.el (shr-put-image): Remove underlines from sliced images.
+	(shr-zoom-image): Compute the region to be replaced more correctly.
+
 2012-02-02  Katsumi Yamaoka  <[email protected]>
 
 	* gnus-msg.el (gnus-gcc-self-resent-messages): New user option.
diff --git a/lisp/shr.el b/lisp/shr.el
index 5a04591..83392cd 100644
--- a/lisp/shr.el
+++ b/lisp/shr.el
@@ -226,17 +226,16 @@ size, and full-buffer size."
     (if (not url)
 	(message "No image under point")
       ;; Delete the old picture.
-      (beginning-of-line)
-      (while (get-text-property (point) 'display)
-	(forward-line -1))
-      (forward-line 1)
-      (let ((start (point)))
-	(while (get-text-property (point) 'display)
-	  (forward-line 1))
-	(forward-line -1)
-	(delete-region start (point))
+      (while (get-text-property (point) 'image-url)
+	(forward-char -1))
 	(forward-char 1)
-	(put-text-property start (point) 'display nil))
+      (let ((start (point)))
+	(while (get-text-property (point) 'image-url)
+	  (forward-char 1))
+	(forward-char -1)
+	(put-text-property start (point) 'display nil)
+	(when (> (- (point) start) 2)
+	  (delete-region start (1- (point)))))
       (message "Inserting %s..." url)
       (url-retrieve url 'shr-image-fetched
 		    (list (current-buffer) (1- (point)) (point-marker)
@@ -547,10 +546,16 @@ size, and full-buffer size."
         (with-current-buffer buffer
 	  (save-excursion
 	    (let ((alt (buffer-substring start end))
+		  (properties (text-properties-at start))
 		  (inhibit-read-only t))
 	      (delete-region start end)
 	      (goto-char start)
-	      (funcall shr-put-image-function data alt flags)))))))
+	      (funcall shr-put-image-function data alt flags)
+	      (while properties
+		(let ((type (pop properties))
+		      (value (pop properties)))
+		  (unless (memq type '(display image-size))
+		    (put-text-property start (point) type value))))))))))
   (kill-buffer (current-buffer)))
 
 (defun shr-put-image (data alt &optional flags)
@@ -574,7 +579,10 @@ size, and full-buffer size."
 		     (> (car (image-size image t)) 400))
 	    (insert "\n"))
 	  (if (eq size 'original)
+	      (let ((overlays (overlays-at (point))))
 	      (insert-sliced-image image (or alt "*") nil 20 1)
+		(dolist (overlay overlays)
+		  (overlay-put overlay 'face 'default)))
 	    (insert-image image (or alt "*")))
 	  (put-text-property start (point) 'image-size size)
 	  (when (image-animated-p image)

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog |    5 +++++
 lisp/shr.el    |   32 ++++++++++++++++++++------------
 2 files changed, 25 insertions(+), 12 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.