Repository navigation
Conversation
The mouse encoding (SGR / SGR-pixels) was tracked internally but never exposed on the public Terminal, so addon-serialize could not restore it: a serialized terminal came back with mouse tracking intact but the encoding reset to default. Add IModes.mouseEncoding alongside mouseTrackingMode, derived from the same MouseStateService the tracking mode already reads, and emit the matching DECSET from SerializeAddon.
2 of 3 tasks
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.
SerializeAddonrestores the mouse tracking mode (?9/?1000/?1002/?1003) but not the mouse encoding. If a terminal is serialized while an app has SGR (CSI ? 1006 h) or SGR-pixels (CSI ? 1016 h) reporting on, it comes back with the default encoding. The app then gets X10-style reports it isn't expecting, and clicks past column 223 aren't reported at all.The addon builds its mode preamble from
terminal.modes, which has no encoding member, so this PR adds one:IModes.mouseEncoding: 'default' | 'sgr' | 'sgr-pixels'inxterm.d.tsandxterm-headless.d.ts. It's read frommouseStateService.activeEncoding, next to wheremouseTrackingModereadsactiveProtocol, and the values followmouseTrackingMode's lowercase style.SerializeAddonemitsCSI ? 1006 horCSI ? 1016 hfor a non-default encoding. It's emitted separately from the tracking mode, because xterm.js tracks the two separately and an app may set the encoding before it turns tracking on.Motivation
Dormouse moves live terminals between windows by serializing each one and replaying it into a new
Terminal. Right now we work around this bug by readingterminal._core.mouseStateService.activeEncodingand appending the DECSET ourselves. With this PR we can delete that.The same gap affects VS Code: on reconnect,
triggerReplay()insrc/vs/platform/terminal/node/ptyService.tsreplaysserialize()from its headless mirror with modes included, so a TUI that enabled SGR mouse gets its tracking back after a window reload but not its encoding.Test plan
modes.mouseEncodingset and reset for 1006 and 1016;defaultsupdated.Terminal;defaultsupdated.SerializeAddonround-trips 1006, 1016, and tracking plus encoding together.npm run test-unit,npm run lint,npm run lint-api.