diff lisp/mouse.el @ 41034:edd3baa8e385

(mouse-drag-region): Don't run the up-event handler if window start changed due to the down-mouse event.
author Richard M. Stallman <rms@gnu.org>
date Wed, 14 Nov 2001 02:49:15 +0000
parents 0701d564260d
children 64ee9a4a698e
line wrap: on
line diff
--- a/lisp/mouse.el	Wed Nov 14 02:48:17 2001 +0000
+++ b/lisp/mouse.el	Wed Nov 14 02:49:15 2001 +0000
@@ -677,6 +677,7 @@
 	 (start-posn (event-start start-event))
 	 (start-point (posn-point start-posn))
 	 (start-window (posn-window start-posn))
+	 (start-window-start (window-start start-window))
 	 (start-frame (window-frame start-window))
 	 (start-hscroll (window-hscroll start-window))
 	 (bounds (window-edges start-window))
@@ -742,6 +743,7 @@
 		  (mouse-scroll-subr start-window (1+ (- mouse-row bottom))
 				     mouse-drag-overlay start-point)
 		  (setq end-of-range (overlay-end mouse-drag-overlay))))))))))
+      
       ;; In case we did not get a mouse-motion event
       ;; for the final move of the mouse before a drag event
       ;; pretend that we did get one.
@@ -750,7 +752,6 @@
 		       end-point (posn-point end))
 		 (eq (posn-window end) start-window)
 		 (integer-or-marker-p end-point))
-
 	;; Go to START-POINT first, so that when we move to END-POINT,
 	;; if it's in the middle of intangible text,
 	;; point jumps in the direction away from START-POINT.
@@ -802,7 +803,18 @@
 	      (delete-overlay mouse-drag-overlay)
 	      ;; Run the binding of the terminating up-event.
 	      (when (and (functionp fun)
-			 (= start-hscroll (window-hscroll start-window)))
+			 (= start-hscroll (window-hscroll start-window))
+			 ;; Don't run the up-event handler if the
+			 ;; window start changed in a redisplay after
+			 ;; the mouse-set-point for the down-mouse
+			 ;; event at the beginning of this function.
+			 ;; When the window start has changed, the
+			 ;; up-mouse event will contain a different
+			 ;; position due to the new window contents,
+			 ;; and point is set again.
+			 (or end-point
+			     (= (window-start start-window)
+				start-window-start)))
 		(setq unread-command-events
 		      (cons event unread-command-events)))))
 	(delete-overlay mouse-drag-overlay)))))