unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28658: 27.0.50; [PATCH] double/triple clicking in xterm-mouse-mode doesn't respect mouse position
@ 2017-09-30 22:06 Alex
  2017-10-01  3:56 ` Alex
  2017-10-05 10:36 ` Eli Zaretskii
  0 siblings, 2 replies; 16+ messages in thread
From: Alex @ 2017-09-30 22:06 UTC (permalink / raw)
  To: 28658

[-- Attachment #1: Type: text/plain, Size: 543 bytes --]

1. emacs -Q -nw
2. M-x xterm-mouse-mode RET
3. Click once, then quickly move the cursor to a different word and click again.
4. Notice that the 2nd click was registered as a double click even
though the cursor moved.
5. Click once, and quickly perform step 3 again. Notice that the 3rd
click was registered as a triple click even though the cursor moved.

I've attached a patch that fixes this behaviour. It would be nice if it
worked with pixel positions rather than character positions, but I'm not
sure how to do that in a terminal Emacs.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: click --]
[-- Type: text/x-diff, Size: 1760 bytes --]

From 77590f427ba962f5efc3f07d2e4dcadb4ec1237d Mon Sep 17 00:00:00 2001
From: Alexander Gramiak <agrambot@gmail.com>
Date: Sat, 30 Sep 2017 15:47:56 -0600
Subject: [PATCH] Increase xterm click count only with unchanged point

* lisp/xt-mouse.el (xterm-mouse-event): Save the last click's position
and check it against the current click's position.
---
 lisp/xt-mouse.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index 772a72d5c5..dc202e78f6 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -278,6 +278,8 @@ xterm-mouse-event
                (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
@@ -290,12 +292,14 @@ xterm-mouse-event
               (xterm-mouse--set-click-count event click-count)))
            ((not last-time) nil)
            ((and (> double-click-time (* 1000 (- this-time last-time)))
+                 (eq x last-x)
+                 (eq y last-y)
                  (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)
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-10-09  7:11 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-30 22:06 bug#28658: 27.0.50; [PATCH] double/triple clicking in xterm-mouse-mode doesn't respect mouse position Alex
2017-10-01  3:56 ` Alex
2017-10-01  8:23   ` martin rudalics
2017-10-01 18:30     ` Alex
2017-10-05 10:52       ` Eli Zaretskii
2017-10-05 10:52   ` Eli Zaretskii
2017-10-06  0:03     ` Alex
2017-10-06  7:44       ` Eli Zaretskii
2017-10-09  2:37         ` Alex
2017-10-09  7:11           ` Eli Zaretskii
2017-10-05 10:36 ` Eli Zaretskii
2017-10-06  0:14   ` Alex
2017-10-06  7:14     ` Eli Zaretskii
2017-10-07 21:57       ` Alex
2017-10-08  7:42         ` Eli Zaretskii
2017-10-08 23:44           ` Alex

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).