]> git.eshelyaron.com Git - emacs.git/commitdiff
Increase xterm click count only within double-click-fuzz
authorAlexander Gramiak <agrambot@gmail.com>
Sat, 30 Sep 2017 21:47:56 +0000 (15:47 -0600)
committerAlexander Gramiak <agrambot@gmail.com>
Sun, 8 Oct 2017 23:20:46 +0000 (17:20 -0600)
* lisp/xt-mouse.el (xterm-mouse-event): Save the last click's position
and check it against the current click's position.  (Bug#28658)

lisp/xt-mouse.el

index d268e1a3fe7d11eb72012a6724c0d670e8bc9eca..d704cfa4e8f42bf908a2819ca64b284ce2efb09d 100644 (file)
@@ -278,6 +278,8 @@ which is the \"1006\" extension implemented in Xterm >= 277."
                (last-name (symbol-name last-type))
                (last-time (nth 1 last-click))
                (click-count (nth 2 last-click))
+               (last-x (nth 3 last-click))
+               (last-y (nth 4 last-click))
                (this-time (float-time))
                (name (symbol-name type)))
           (cond
@@ -292,12 +294,16 @@ which is the \"1006\" extension implemented in Xterm >= 277."
                  double-click-time
                  (or (eq double-click-time t)
                      (> double-click-time (* 1000 (- this-time last-time))))
+                 (<= (abs (- x last-x))
+                     (/ double-click-fuzz 8))
+                 (<= (abs (- y last-y))
+                     (/ double-click-fuzz 8))
                  (equal last-name (replace-match "" t t name)))
             (setq click-count (1+ click-count))
             (xterm-mouse--set-click-count event click-count))
            (t (setq click-count 1)))
           (set-terminal-parameter nil 'xterm-mouse-last-click
-                                  (list type this-time click-count)))
+                                  (list type this-time click-count x y)))
 
         (set-terminal-parameter nil 'xterm-mouse-x x)
         (set-terminal-parameter nil 'xterm-mouse-y y)