From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alex Newsgroups: gmane.emacs.bugs Subject: bug#28658: 27.0.50; [PATCH] double/triple clicking in xterm-mouse-mode doesn't respect mouse position Date: Sat, 30 Sep 2017 16:06:34 -0600 Message-ID: <87r2unyh79.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1506809231 12891 195.159.176.226 (30 Sep 2017 22:07:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 30 Sep 2017 22:07:11 +0000 (UTC) To: 28658@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 01 00:07:07 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyPuc-0002yE-QC for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Oct 2017 00:07:07 +0200 Original-Received: from localhost ([::1]:40503 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyPuk-0004Lw-3X for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Sep 2017 18:07:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyPud-0004Ld-Ub for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2017 18:07:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dyPuY-00046e-T4 for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2017 18:07:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:32876) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dyPuY-00046K-P2 for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2017 18:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dyPuY-0003jz-F0 for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2017 18:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Sep 2017 22:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 28658 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.150680922014367 (code B ref -1); Sat, 30 Sep 2017 22:07:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Sep 2017 22:07:00 +0000 Original-Received: from localhost ([127.0.0.1]:41557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyPuW-0003jf-Aj for submit@debbugs.gnu.org; Sat, 30 Sep 2017 18:07:00 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60655) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyPuU-0003jP-5d for submit@debbugs.gnu.org; Sat, 30 Sep 2017 18:06:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dyPuN-0003rQ-Pd for submit@debbugs.gnu.org; Sat, 30 Sep 2017 18:06:52 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:55351) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dyPuN-0003r4-KW for submit@debbugs.gnu.org; Sat, 30 Sep 2017 18:06:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyPuM-0004CS-2f for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2017 18:06:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dyPuH-0003js-2T for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2017 18:06:50 -0400 Original-Received: from mail-it0-x235.google.com ([2607:f8b0:4001:c0b::235]:46456) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dyPuG-0003fu-SS for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2017 18:06:45 -0400 Original-Received: by mail-it0-x235.google.com with SMTP id d192so3496418itd.1 for ; Sat, 30 Sep 2017 15:06:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=aaS79I5k0rCt7JWJbDPNDVJg48MKNi5sxYnuUfJxyj8=; b=XaIfIecPc36UjUspCfo213LnE1iuZ7oecIKLcqKHJQ8GjxzBVVgYQajidOC0v2alkF 8OP3ERqGzYOwYxMU9Hr+kzL0fWqxpHvx7pB6pMlnPrMmWFKAt59LyZf+CAnIbPTtaNAu /CS72CiqCCqc6+MDCPelJ6QQ4BO6Y0ICiXhOdl4svc6MCN8+0cL2UWpq/vLXZ3og8SNp kJcAUOF1nVIiVSWjwYcnFoh8X4PTCeZfFPGj12pFVaw1G9p+os2qrwSKIIX1ZY7nu0gA ugGRjcZlzwXrWwTsN1lzRqkSWF3t5HR5yNRhu8RO1DlXLUrcGQ9S2r2DZmY06GEVUbJw HmAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=aaS79I5k0rCt7JWJbDPNDVJg48MKNi5sxYnuUfJxyj8=; b=KQzqoJsp8kRGQJVDt1V+wQFmnaTC+d1/zH/31u91XyHIRNyVp1zi/3+f1KjQ1hlJjw TjQz4nz75AFn1KZzZwyrKOzaw5o6WilQkp1nyPInMRfwkE4ZWwux4Psvk0dLw1oHPsFW a8/K5m4DhPLBqL1CMZMKlAuAfRdQdq6E9tfuBEwWO+sa8SXGGpCY1C4tm6HuTWl9hlWs jG4KLOsz/NA3ZRYo0Pp36m1yhqct7ul4Ew7NRPRQ3eyWktFMnkEDFLRpNYvZcbQl3IGA AgHwNzVjydQkkuFxMxSi7XdxfZulcQTZnSeicBhpTXctRWMJ3UyDK8nqCSh8FUBrAiHj Zt7w== X-Gm-Message-State: AMCzsaUBGmmwJ35MrRlyMhD9EwbVi0qOv6FaTL3mayv410As3BU0r/bw 9gAk3HCVpkp3DeTKI7zL0LZReQ== X-Google-Smtp-Source: AOwi7QB4CzQdhPvpj80HGCnporDvBYcEz0FgUJh1jRkov4hnfNGb/sbGZXclsW7pIE+tLq6ku3CJ2A== X-Received: by 10.36.178.19 with SMTP id u19mr3001051ite.64.1506809202684; Sat, 30 Sep 2017 15:06:42 -0700 (PDT) Original-Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59]) by smtp.gmail.com with ESMTPSA id i203sm2847708itb.20.2017.09.30.15.06.41 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 30 Sep 2017 15:06:41 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:137717 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Increase-xterm-click-count-only-with-unchanged-point.patch Content-Description: click >From 77590f427ba962f5efc3f07d2e4dcadb4ec1237d Mon Sep 17 00:00:00 2001 From: Alexander Gramiak 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 --=-=-=--