# HG changeset patch # User Richard M. Stallman # Date 1005706155 0 # Node ID edd3baa8e3855be9d17a21ca1e16bdedb0d1aac4 # Parent 0701d564260d06f6e047f2b3322f301d9426ce1e (mouse-drag-region): Don't run the up-event handler if window start changed due to the down-mouse event. diff -r 0701d564260d -r edd3baa8e385 lisp/mouse.el --- 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)))))