]> git.eshelyaron.com Git - emacs.git/commitdiff
Backport fix for Bug#11989 from trunk.
authorChong Yidong <cyd@gnu.org>
Wed, 25 Jul 2012 06:14:30 +0000 (14:14 +0800)
committerChong Yidong <cyd@gnu.org>
Wed, 25 Jul 2012 06:14:30 +0000 (14:14 +0800)
* mouse.el (mouse-drag-track): Do not set the mark if the user
releases the mouse without selecting anything.

lisp/ChangeLog
lisp/mouse.el

index 9cda817fab6cdd75159d4e710becd75a54f8eeb1..e693f1a62f6adaba8f1c08d0c9cb0fdc2f1131b0 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-25  Chong Yidong  <cyd@gnu.org>
+
+       * 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  <sdl.web@gmail.com>
 
        * progmodes/cc-cmds.el (c-defun-name): Use
index 20a78e556517c1d990a6fee2a777bedab2dbd4ca..d9511c722ca1631250bec0782203c71dbbbad44a 100644 (file)
@@ -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