emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r100728: Fix multi-click selection be


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r100728: Fix multi-click selection behavior (Bug#6565).
Date: Mon, 05 Jul 2010 12:42:50 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100728
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Mon 2010-07-05 12:42:50 -0400
message:
  Fix multi-click selection behavior (Bug#6565).
  
  * lisp/mouse.el (mouse-drag-track): Call mouse-start-end to handle
  word/line selection (Bug#6565).
modified:
  lisp/ChangeLog
  lisp/mouse.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-07-04 14:32:00 +0000
+++ b/lisp/ChangeLog    2010-07-05 16:42:50 +0000
@@ -1,3 +1,8 @@
+2010-07-05  Chong Yidong  <address@hidden>
+
+       * mouse.el (mouse-drag-track): Call mouse-start-end to handle
+       word/line selection (Bug#6565).
+
 2010-07-04  Juanma Barranquero  <address@hidden>
 
        * net/dbus.el (dbus-send-signal): Declare function.

=== modified file 'lisp/mouse.el'
--- a/lisp/mouse.el     2010-07-03 03:07:48 +0000
+++ b/lisp/mouse.el     2010-07-05 16:42:50 +0000
@@ -936,25 +936,30 @@
                        ;; treatment, in case we click on a link inside an
                        ;; intangible text.
                        (mouse-on-link-p start-posn)))
+        (click-count (1- (event-click-count start-event)))
         ;; Suppress automatic hscrolling, because that is a nuisance
         ;; when setting point near the right fringe (but see below).
         (automatic-hscrolling-saved automatic-hscrolling)
         (automatic-hscrolling nil)
         event end end-point)
 
-    (setq mouse-selection-click-count (1- (event-click-count start-event)))
+    (setq mouse-selection-click-count click-count)
     ;; In case the down click is in the middle of some intangible text,
     ;; use the end of that text, and put it in START-POINT.
     (if (< (point) start-point)
        (goto-char start-point))
     (setq start-point (point))
 
-    ;; Activate the mark.
+    ;; Activate the region, using `mouse-start-end' to determine where
+    ;; to put point and mark (e.g., double-click will select a word).
     (setq transient-mark-mode
          (if (eq transient-mark-mode 'lambda)
              '(only)
            (cons 'only transient-mark-mode)))
-    (push-mark nil nil t)
+    (let ((range (mouse-start-end start-point start-point click-count)))
+      (goto-char (nth 0 range))
+      (push-mark nil nil t)
+      (goto-char (nth 1 range)))
 
     ;; Track the mouse until we get a non-movement event.
     (track-mouse
@@ -1017,8 +1022,9 @@
                     (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)
+         (if do-multi-click
+             (goto-char start-point)
+           (deactivate-mark))
          (when (and (functionp fun)
                     (= start-hscroll (window-hscroll start-window))
                     ;; Don't run the up-event handler if the window


reply via email to

[Prev in Thread] Current Thread [Next in Thread]