Keep SGR mouse format winning in snapshot replay - #558
Merged
Conversation
Mouse format is last-writer-wins, but the formatter re-emits mode bits in enum order — SGR (?1006h) before urxvt (?1015h). crossterm enables urxvt then SGR, so replaying a snapshot flipped the client into urxvt, an encoding crossterm TUIs don't parse: their mouse went dead after every attach, resize, or resync. Re-assert SGR whenever the payload carries both, guarded on the actual order so a fixed formatter turns this into a no-op. Refs: #441
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A snapshot payload re-emits mouse modes from the terminal's mode bits in enum order — SGR (
?1006h) before urxvt (?1015h). crossterm'sEnableMouseCapturesets urxvt then SGR, so a replaying client landed in urxvt, an encoding crossterm TUIs don't parse. Their mouse went dead after every attach, resize, or backlog resync, and stayed dead because a TUI never re-sends state it believes is already set (#441).format_vtnow re-asserts?1006hwhenever the payload carries both formats with urxvt last. The guard checks the actual byte order, so a formatter that one day restates the winner itself turns this into a no-op.?1015honly ever appears in the wild as the compatibility fallback written before?1006h, so preferring SGR reconstructs the real state.Regression tests cover crossterm's exact enable sequence, a second replay hop, and an SGR-only host staying untouched.
Fixes #441
Release Notes: