Incorrect escape sequence for mouse up #296
Labels
Product-Conhost
For issues in the Console codebase
Resolution-Fix-Available
It's available in an Insiders build or a release
Work-Item
It's being tracked by an actual work item internally. (to be removed soon)
Milestone
Microsoft Windows [Version 10.0.17134.345]
When the new console subsystem is configured to pass mouse events to running applications as escape sequences in SGR mode, the mouse up event is reported as "button 4 up", regardless of which button was pressed. For example, when the left mouse button is pressed/released, the escape sequence should be
ESC [< 0 ; col ; row M
ESC [< 0 ; col ; row m
i.e. left button (0) down (M) then up (m)
Instead, console sends this sequence:
ESC [< 0 ; col ; row M
ESC [< 3 ; col ; row m
i.e. left button (0) down (M), then fourth button (3) up (m).
Regardless of which mouse button is pressed, the up event always says button number 3 instead of the correct button.
One simple repro involves running bash under WSL, with "Quick Edit Mode" turned off in the console properties. Use echo as belo to enable mouse reports in SGR mode, then press/release the left mouse button.
In the last line above, which shows the printable parts of the mouse report sequence, the character after M is 3, but it should be 0. The 31 and 30 numbers depend on the mouse position; it is the 0; .. 3; (should be 0; .. 0;) that is the problem.
I first noticed this problem using emacs in a docker container with xterm-mouse-mode with mouse-wheel-mode enabled. The symptom there is that a left mouse click is followed by a spurious wheel scroll action. After isolating the problem to "wrong up event", I then reproduced it using many different ways of displaying the mouse escape sequence (all under the new console subsystem).
The following reference describes the expected behavior, which is consistent with the behavior of xterm under Linux:
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
The text was updated successfully, but these errors were encountered: