-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore the DECCTR color table report over conpty (#13227)
## Summary of the Pull Request Up to now we haven't supported passing `DCS` sequences over conpty, so any `DCS` operations would just be ignored in Windows Terminal. This PR introduces a mechanism whereby we can selectively pass through operations that could reasonably be handled by the connected terminal without interfering with the regular conpty renderer. For now this is just used to support restoring the `DECCTR` color table report. ## References Support for `DECCTR` was originally added to conhost in PR #13139. ## PR Checklist * [x] Closes #13223 * [x] CLA signed. * [x] Tests added/passed * [ ] Documentation updated. * [ ] Schema updated. * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx ## Detailed Description of the Pull Request / Additional comments The way this works is we have a helper method in `AdaptDispatch` that `DCS` operations can use to create a passthrough `StringHandler` for the incoming data instead of their usual handler. To make this passthrough process more efficient, the handler buffers the data before forwarding it to conpty. However, it's important that we aren't holding back data if output is paused before the string terminator, so we need to flush the buffer whenever we reach the end of the current write operation. This is achieved by querying a new method in the `StateMachine` that lets us know if we're currently dealing with the last character. Another issue that came up was with the way the `StateMachine` caches sequences that it might later need to forward to conpty. In the case of string sequences like `DCS`, we don't want the actual string data cached here, because that will just waste memory, and can also result in the data being mistakenly output. So I've now disabled that caching when we're in any of the string processing states. ## Validation Steps Performed I've manually confirmed that the `DECCTR` sequence can now update the color table in Windows Terminal. I've also added a new unit test in `ConptyRoundtripTests` to verify the sequence is being passed through successfully.
- Loading branch information
Showing
5 changed files
with
117 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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