[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#67457: 29.1; Error when dragging mode line in terminal
From: |
Jared Finder |
Subject: |
bug#67457: 29.1; Error when dragging mode line in terminal |
Date: |
Thu, 07 Dec 2023 14:35:57 -0800 |
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 <jared@finder.org>
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 <monnier@iro.umontreal.ca>
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