Subject: Re: bug#73469: 29.4; mouse passing on terminal window generates events

From: Jared Finder <[email-masked]>
Date: Sat, 28 Sep 2024 10:50:53 -0700

On 2024-09-27 03:25, Eli Zaretskii wrote:
>> From: Francesco Potortì <[email-masked]>
>> Date: Fri, 27 Sep 2024 09:48:24 +0200
>> Cc: [email-masked]
>> 
>> I have found the culprit: it is xterm-mouse-mode.

Could you please reshare the lossage, making sure you are moving the 
mouse around over an otherwise empty buffer and not holding any 
modifiers or mouse buttons? I saw in the original bug report that the 
report included lossage containing lines like

ESC [ M 3 5 ; C-<mouse-1>  1 2 0 ; 2 1 M

There are two things that are surprising here, hence my ask for fresh 
logs:

The most surprising thing is the "ESC [ M" prefix. My read of 
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-X10-compatibility-mode 
is that prefix indicates a three byte mouse state should follow but it 
appears that (if I ignore the C-<mouse-1> in the middle) this is 
actually an SGR mouse state. However, SGR mouse state is supposed to be 
reported with an "ESC [ <" prefix and end with "M" only if a mouse 
button is down. If no mouse button is down, it should end with "m".

The C-<mouse-1> in the middle is surprising as well, though I'm noticing 
it's always exactly three bytes after the "ESC [ M prefix".

For comparison, my M-x view lossage for an emacs -Q -nw invocation where 
I enable xterm-mouse-mode and then move the mouse around over an empty 
buffer looks like this:

  ; 2 m ESC [ < 3 5 ; 3 1 ; 2 m ESC [ < 3 5 ; 3 0 ; 2 m ESC [ < 3 5 ; 2 9 
; 2 m ESC [ < 3 5 ; 2 8 ; 2 m ESC [ < 3 5 ; 2
7 ; 2 m ESC [ < 3 5 ; 2 6 ; 2 m ESC [ < 3 5 ; 2 6 ; 3 m ESC [ < 3 5 ; 2 
5 ; 3 m ESC [ < 3 5 ; 2 5 ; 4 m ESC [ < 3 5 ; 2
  6 ; 4 m ESC [ < 3 5 ; 2 6 ; 5 m ESC [ < 3 5 ; 2 7 ; 5 m ESC [ < 3 5 ; 2 
8 ; 6 m ESC [ < 3 5 ; 2 9 ; 6 m ESC [ < 3 5 ;
3 0 ; 6 m ESC [ < 3 5 ; 3 1 ; 6 m ESC [ < 3 5 ; 3 2 ; 6 m ESC [ < 3 5 ; 
3 3 ; 6 m ESC [ < 3 5 ; 3 4 ; 5 m ESC [ < 3 5 ;
  3 5 ; 5 m ESC [ < 3 5 ; 3 5 ; 4 m ESC [ < 3 5 ; 3 6 ; 4 m ESC [ < 3 5 ; 
3 6 ; 3 m ESC [ < 3 5 ; 3 6 ; 2 m ESC x ;; exe
cute-extended-command

   -- MJF