add SGR mouse parsing on POSIX while preserving legacy X10 behavior - #289
Open
mastaab wants to merge 2 commits into
Open
add SGR mouse parsing on POSIX while preserving legacy X10 behavior#289mastaab wants to merge 2 commits into
mastaab wants to merge 2 commits into
Conversation
Enable 1006 mouse mode and parse SGR mouse sequences while preserving legacy X10 support. This removes ambiguous wheel/button decoding and adds parser tests for wheel, press/release, modifiers, and motion-bit handling.
Keep legacy X10 button mapping behavior while using spec-correct mapping for SGR sequences to avoid regressions in existing consumers. Also enable both 1005 and 1006 mouse modes on POSIX and add parser tests covering legacy mapping and mixed SGR/X10 event streams.
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.
Summary
This PR adds SGR mouse event support on POSIX terminals without breaking existing X10-compatible behavior.
CSI < cb;x;y M/m) inPosixEventParserCSI M ...) and preserve its historical button mapping behavior1005+1006) alongside existing tracking modes (1000/1002/1003)1005and1006when leaving raw modeWhy
Modern terminal emulators commonly support and prefer SGR mouse reporting (
1006) for richer, unambiguous mouse data (larger coordinates and explicit press/release suffixes).Examples include Ghostty and WezTerm (also supported by Kitty and recent iTerm2).
Adding SGR support improves interoperability on modern terminals, while preserving X10 behavior avoids regressions for existing Mordant consumers that rely on legacy decoding semantics.
Compatibility Notes
Normal,Button,Any) continue to work as beforeTests
Added/updated
PosixEventParsertests to cover: