From 971635eeb9b999afd6f8eda10c978f8641022fb2 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Wed, 25 Jul 2012 14:14:30 +0800 Subject: [PATCH] Backport fix for Bug#11989 from trunk. * mouse.el (mouse-drag-track): Do not set the mark if the user releases the mouse without selecting anything. --- lisp/ChangeLog | 5 +++++ lisp/mouse.el | 15 +++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9cda817fab6..e693f1a62f6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-07-25 Chong Yidong + + * mouse.el (mouse-drag-track): Do not set the mark if the user + releases the mouse without selecting anything (Bug#11588). + 2012-07-21 Leo Liu * progmodes/cc-cmds.el (c-defun-name): Use diff --git a/lisp/mouse.el b/lisp/mouse.el index 20a78e55651..d9511c722ca 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -806,7 +806,7 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by ;; when setting point near the right fringe (but see below). (automatic-hscrolling-saved automatic-hscrolling) (automatic-hscrolling nil) - event end end-point) + moved-off-start event end end-point) (setq mouse-selection-click-count click-count) ;; In case the down click is in the middle of some intangible text, @@ -841,6 +841,9 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by (redisplay)) (setq end (event-end event) end-point (posn-point end)) + ;; Note whether the mouse has left the starting position. + (unless (eq end-point start-point) + (setq moved-off-start t)) (if (and (eq (posn-window end) start-window) (integer-or-marker-p end-point)) (mouse--drag-set-mark-and-point start-point @@ -881,11 +884,11 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by (let (deactivate-mark) (copy-region-as-kill (mark) (point))))) - ;; If point hasn't moved, run the binding of the - ;; terminating up-event. - (if do-multi-click - (goto-char start-point) - (deactivate-mark)) + ;; Otherwise, run binding of terminating up-event. + (cond + (do-multi-click (goto-char start-point)) + (moved-off-start (deactivate-mark)) + (t (pop-mark))) (when (and (functionp fun) (= start-hscroll (window-hscroll start-window)) ;; Don't run the up-event handler if the window -- 2.11.4.GIT