diff options
author | Richard M. Stallman <rms@gnu.org> | 1998-11-01 18:17:40 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1998-11-01 18:17:40 +0000 |
commit | 2e3329a5371dfd2ca761a438f7b228162d42f319 (patch) | |
tree | 55d7f3649396302e24df184c7fbec6174b533153 /lisp/mouse.el | |
parent | 0f82d9d807d06b13dede08cee32e3615cab9e121 (diff) | |
download | emacs-2e3329a5371dfd2ca761a438f7b228162d42f319.tar.gz |
(mouse-drag-region): Fake up a mouse-motion event
if we did not get one for the final move.
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r-- | lisp/mouse.el | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index be760126499..b0044a4a991 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -585,8 +585,27 @@ remains active. Otherwise, it remains until the next input event." (setq end-of-range (overlay-start mouse-drag-overlay))) ((>= mouse-row bottom) (mouse-scroll-subr start-window (1+ (- mouse-row bottom)) - mouse-drag-overlay start-point) +a 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. + (when (and (memq 'drag (event-modifiers (car-safe event))) + (setq end (event-end event) + 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. + (goto-char start-point) + (goto-char end-point) + (if (zerop (% click-count 3)) + (setq end-of-range (point))) + (let ((range (mouse-start-end start-point (point) click-count))) + (move-overlay mouse-drag-overlay (car range) (nth 1 range)))) + (if (consp event) (let ((fun (key-binding (vector (car event))))) ;; Run the binding of the terminating up-event, if possible. |