From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jared Finder via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#67457: 29.1; Error when dragging mode line in terminal Date: Thu, 07 Dec 2023 14:35:57 -0800 Message-ID: <69323e0e78afbf4b8c212f156c6af6d8@finder.org> References: <756e757b61f27b310fdb2dc2567bee36@finder.org> <83r0kc9yu3.fsf@gnu.org> <878r6kcro6.fsf@gmail.com> <83o7fg9y2m.fsf@gnu.org> <8734wsdv7f.fsf@gmx.net> <834jh79xsx.fsf@gnu.org> <83msuz88am.fsf@gnu.org> Reply-To: Jared Finder Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30921"; mail-complaints-to="usenet@ciao.gmane.io" Cc: stephen.berman@gmx.net, 67457@debbugs.gnu.org, Stefan Monnier , visuweshm@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 07 23:37:04 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rBMzP-0007p2-Jy for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 07 Dec 2023 23:37:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rBMzE-0005l6-CF; Thu, 07 Dec 2023 17:36:52 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBMzC-0005km-FM for bug-gnu-emacs@gnu.org; Thu, 07 Dec 2023 17:36:50 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rBMzB-0004w6-QF for bug-gnu-emacs@gnu.org; Thu, 07 Dec 2023 17:36:49 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rBMzO-00064X-BW for bug-gnu-emacs@gnu.org; Thu, 07 Dec 2023 17:37:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jared Finder Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Dec 2023 22:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67457 X-GNU-PR-Package: emacs Original-Received: via spool by 67457-submit@debbugs.gnu.org id=B67457.170198857423240 (code B ref 67457); Thu, 07 Dec 2023 22:37:02 +0000 Original-Received: (at 67457) by debbugs.gnu.org; 7 Dec 2023 22:36:14 +0000 Original-Received: from localhost ([127.0.0.1]:43322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBMyc-00062l-8l for submit@debbugs.gnu.org; Thu, 07 Dec 2023 17:36:14 -0500 Original-Received: from greenhill.hpalace.com ([192.155.80.58]:57122) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBMyZ-00062c-9M for 67457@debbugs.gnu.org; Thu, 07 Dec 2023 17:36:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=finder.org; s=2018; t=1701988557; bh=M2SP3B3lQTqXg4YmfU+sW6HiY4cuBKx6j+2nL7vDID0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=shfl+rn9V0KBPEARV9fBem7tUpxADSbYrfd3GcaE/t33bJwIIK/nftDb0ulAtJExK iXXKRQ0bEFXLQB7RiZ7NOvcjl4tWWIYGDBNWvB2ZQb0ut6AtjxVto1oJiMnvpw+M3l bMPvhJJ1nURLoU31HR50vuRSsTsIfeXaBnIlFi/9rIx4N9BSPsaMNHMh1TtOj2bKfV YF4b+fED+8JO58gb0h5YUk8lQCteIWvygSodConB2lc33431hT75U+e78GQ4Y6G7YH nzFTZI5B5GZPwk8vbGTi9Ba5EUZ2ibCJY7GLq+I7W0VTxt45Pgnq0qvquCCH4P9lzH ODyrM7nwVUttA== Original-Received: from mail.finder.org (unknown [192.155.80.58]) by greenhill.hpalace.com (Postfix) with ESMTPSA id C74E048C6; Thu, 7 Dec 2023 22:35:57 +0000 (UTC) In-Reply-To: X-Sender: jared@finder.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275711 Archived-At: Leaving this as one email so both changes are easy to follow. I believe both patches are valuable to apply. On 2023-12-06 15:55, Jared Finder wrote: > On 2023-11-27 08:34, Eli Zaretskii wrote: >>> Date: Mon, 27 Nov 2023 07:16:34 -0800 >>> From: Jared Finder >>> Cc: stephen.berman@gmx.net, visuweshm@gmail.com, >>> 67457@debbugs.gnu.org >>> >>> >> 1. My original patch is likely inaccurate. A better fix would be to >>> >> align the mouse-movement event with how it is emitted under GPM and >>> >> DOS. >>> >> I will investigate. And I have a better patch here. The real issue is that xt-mouse generated mouse-movement events were getting prefixed with mode-line or tab-line symbols but other mouse-movement events were not. The following simple change fixes that: --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -63,9 +63,14 @@ xterm-mouse-translate-1 (is-move (eq 'mouse-movement ev-command)) (is-down (string-match "down-" (symbol-name ev-command)))) - ;; Mouse events symbols must have an 'event-kind property with - ;; the value 'mouse-click. - (when ev-command (put ev-command 'event-kind 'mouse-click)) + ;; Mouse events symbols must have an 'event-kind property set. + ;; Most of them use the value 'mouse-click, but 'mouse-movement + ;; has a different value. See head_table in + ;; keyboard.c. (bug#67457) + (when ev-command (put ev-command 'event-kind + (if (eq ev-command 'mouse-movement) + 'mouse-movement + 'mouse-click))) >>> >> >>> >> 2. Something broke with how GPM mouse mode is enabled between Emacs >>> >> 28.2 >>> >> and HEAD. I can help with a bisect here. >>> > >>> > Thanks, please do, on both counts. >>> >>> Bisect identified the following commit as the bad commit, confirmed >>> locally: >>> >>> jared@debian:^/emacs-devel$ git bisect bad >>> a28ede3a61a70cf83dfcba6c9d314fbb051a3a94 is the first bad commit >>> commit a28ede3a61a70cf83dfcba6c9d314fbb051a3a94 >>> Author: Stefan Monnier >>> Date: >>> t-mouse.el: Make sure we apply the setting to new terminals >>> * lisp/t-mouse.el (gpm-mouse-tty-setup): New function. >>> (gpm-mouse-mode): Use it as well as 'tty-setup-hook". >>> * lisp/term/linux.el (terminal-init-linux): Remove gpm-specific code, >>> not neded any more. >>> lisp/t-mouse.el >>> lisp/term/linux.el | 2 -- >> >> Thanks, adding Stefan to the discussion. > > Following up on #2: The issue here is that after a28ede, > gpm-mouse-tty-setup is never added to tty-setup-hook since it is only > added within gpm-mouse-mode. This is clearly visible by checking the > value of tty-setup-hook at startup, and after toggling gpm-mouse-mode > off and on again. > > The following simple patch fixes that, while leaving the details of how > gpm-mouse-mode works an internal detail: > > --- a/lisp/term/linux.el > +++ b/lisp/term/linux.el > @@ -13,6 +13,9 @@ terminal-init-linux > ;; Compositions confuse cursor movement. > (setq-default auto-composition-mode "linux") > > + ;; Ensure additional terminal setup is done when `gpm-mouse-mode' is > enabled. > + (ignore-errors (when gpm-mouse-mode (gpm-mouse-mode 1))) > + > ;; Don't translate ESC TAB to backtab as directed by ncurses-6.3. > (define-key input-decode-map "\e\t" nil) > > One could also just revert just the linux.el changes in a28ede, though > that assumes that gpm-mouse-enable exists. > > -- MJF