Subject: Re: bug#28658: 27.0.50; [PATCH] double/triple clicking in xterm-mouse-mode doesn't respect mouse position

From: Eli Zaretskii <[email-masked]>
Date: Thu, 05 Oct 2017 13:36:00 +0300

> From: Alex <[email-masked]>
> Date: Sat, 30 Sep 2017 16:06:34 -0600
> 
> 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.

Thanks, I have a comment to this, but in general this is the right
fix, IMO.

> 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.

You can't: TTY frames cannot discern screen positions with resolution
of more than 1 character.

> @@ -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)

IMO, 'eq' is not right here: this test should obey the value of
double-click-fuzz, whose units on TTY frames are 1/8 of a character.