changeset 93838:90f39a5d591c

(mwheel-scroll): Deactivate any temporarily active region if point moves.
author Chong Yidong <cyd@stupidchicken.com>
date Tue, 08 Apr 2008 05:38:39 +0000
parents 02c33d0cb0a6
children d58a73cce1e6
files lisp/mwheel.el
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mwheel.el	Tue Apr 08 05:38:13 2008 +0000
+++ b/lisp/mwheel.el	Tue Apr 08 05:38:39 2008 +0000
@@ -190,6 +190,10 @@
                      (prog1
                          (selected-window)
                        (select-window (mwheel-event-window event)))))
+	 (buffer (window-buffer curwin))
+	 (opoint (with-current-buffer buffer
+		   (when (eq (car-safe transient-mark-mode) 'only)
+		     (point))))
          (mods
 	  (delq 'click (delq 'double (delq 'triple (event-modifiers event)))))
          (amt (assoc mods mouse-wheel-scroll-amount)))
@@ -224,7 +228,13 @@
                    ;; Make sure we do indeed scroll to the end of the buffer.
                    (end-of-buffer (while t (scroll-up)))))
 		(t (error "Bad binding in mwheel-scroll"))))
-      (if curwin (select-window curwin))))
+      (if curwin (select-window curwin)))
+    ;; If there is a temporarily active region, deactivate it iff
+    ;; scrolling moves point.
+    (when opoint
+      (with-current-buffer buffer
+	(when (/= opoint (point))
+	  (deactivate-mark)))))
   (when (and mouse-wheel-click-event mouse-wheel-inhibit-click-time)
     (if mwheel-inhibit-click-event-timer
 	(cancel-timer mwheel-inhibit-click-event-timer)