Skip to content

Conversation

@j4james
Copy link
Collaborator

@j4james j4james commented May 2, 2025

According to the documentation, the final character of an SGR mouse
report is meant to be M for a button press and m for a button
release. However it isn't clear what the final character should be for
motion events, and we were using an m if there weren't any buttons
held down at the time, while all other terminals used an M, regardless
of the button state.

This PR updates our implementation to match what everyone else is doing,
since our interpretation of the spec was causing problems for some apps.

Validation Steps Performed

I've manually tested the new behavior in Vttest, and confirmed that our
mouse reports now match Xterm more closely, and I've tested with v0.42.0
of Zellij, which was previous glitching badly in Windows Terminal, but
now works correctly.

I've also updated our unit tests for the SGR mouse mode to reflect the
correct report format.

Closes #18712

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels completely correct. Thanks for maintaining our compatibilty and correctness :)

@DHowett
Copy link
Member

DHowett commented May 2, 2025

/azp run

@DHowett DHowett enabled auto-merge (squash) May 2, 2025 19:29
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@DHowett DHowett closed this May 2, 2025
auto-merge was automatically disabled May 2, 2025 22:34

Pull request was closed

@DHowett DHowett reopened this May 2, 2025
@DHowett
Copy link
Member

DHowett commented May 2, 2025

I've tried to kick the CLA robot... let's see if it works?

@DHowett
Copy link
Member

DHowett commented May 2, 2025

IT WORKS

@DHowett DHowett enabled auto-merge (squash) May 2, 2025 22:35
@DHowett DHowett merged commit 865f5e5 into microsoft:main May 2, 2025
17 checks passed
@j4james j4james deleted the fix-sgr-mouse branch May 3, 2025 11:48
@DHowett DHowett moved this from To Cherry Pick to Cherry Picked in 1.22 Servicing Pipeline May 5, 2025
@DHowett DHowett moved this from To Cherry Pick to Cherry Picked in 1.23 Servicing Pipeline May 5, 2025
DHowett pushed a commit that referenced this pull request May 5, 2025
According to the documentation, the final character of an SGR mouse
report is meant to be `M` for a button press and `m` for a button
release. However it isn't clear what the final character should be for
motion events, and we were using an `m` if there weren't any buttons
held down at the time, while all other terminals used an `M`, regardless
of the button state.

This PR updates our implementation to match what everyone else is doing,
since our interpretation of the spec was causing problems for some apps.

## Validation Steps Performed

I've manually tested the new behavior in Vttest, and confirmed that our
mouse reports now match Xterm more closely, and I've tested with v0.42.0
of Zellij, which was previous glitching badly in Windows Terminal, but
now works correctly.

I've also updated our unit tests for the SGR mouse mode to reflect the
correct report format.

Closes #18712

(cherry picked from commit 865f5e5)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgZ9_Ew
Service-Version: 1.23
DHowett pushed a commit that referenced this pull request May 5, 2025
According to the documentation, the final character of an SGR mouse
report is meant to be `M` for a button press and `m` for a button
release. However it isn't clear what the final character should be for
motion events, and we were using an `m` if there weren't any buttons
held down at the time, while all other terminals used an `M`, regardless
of the button state.

This PR updates our implementation to match what everyone else is doing,
since our interpretation of the spec was causing problems for some apps.

I've manually tested the new behavior in Vttest, and confirmed that our
mouse reports now match Xterm more closely, and I've tested with v0.42.0
of Zellij, which was previous glitching badly in Windows Terminal, but
now works correctly.

I've also updated our unit tests for the SGR mouse mode to reflect the
correct report format.

Closes #18712

(cherry picked from commit 865f5e5)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgZ9_E0
Service-Version: 1.22
@DHowett DHowett moved this from Cherry Picked to Shipped in 1.23 Servicing Pipeline Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Cherry Picked

Development

Successfully merging this pull request may close these issues.

Any-event SGR mouse reports are wrong

3 participants