[PR #6809] Add support for DECSCNM in Windows Terminal #26788

Closed
opened 2026-01-31 09:18:09 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/6809

State: closed
Merged: Yes


Summary of the Pull Request

This PR adds full support for the DECSCNM reverse screen mode in the Windows Terminal to align with the implementation in conhost.

References

  • The conhost implementation of DECSCNM was in PR #3817.
  • WT originally inherited that functionality via the colors being passed through, but that behaviour was lost in PR #6506.

PR Checklist

  • Closes Add title to split window (#6622)
  • CLA signed.
  • Tests added/passed
  • Documentation updated. If checked, please file a pull request on our docs repo and link it here: #xxx
  • 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: #6622

Detailed Description of the Pull Request / Additional comments

The AdaptDispatch::SetScreenMode now checks if it's in conpty mode and simply returns false to force a pass-through of the mode change. And the TerminalDispatch now has its own SetScreenMode implementation that tracks any changes to the reversed state, and triggers a redraw in the renderer.

To make the renderer work, we just needed to update the GetForegroundColor and GetBackgroundColor methods of the terminal's IRenderData implementation to check the reversed state, and switch the colors being calculated, the same way the LookupForegroundColor and LookupBackgroundColor methods work in the conhost Settings class.

Validation Steps Performed

I've manually tested the DECSCNM functionality for Windows Terminal in Vttest, and also with some of my own test scripts.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/6809 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request This PR adds full support for the `DECSCNM` reverse screen mode in the Windows Terminal to align with the implementation in conhost. ## References * The conhost implementation of `DECSCNM` was in PR #3817. * WT originally inherited that functionality via the colors being passed through, but that behaviour was lost in PR #6506. ## PR Checklist * [x] Closes #6622 * [x] CLA signed. * [ ] Tests added/passed * [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx * [ ] Schema updated. * [x] 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: #6622 ## Detailed Description of the Pull Request / Additional comments The `AdaptDispatch::SetScreenMode` now checks if it's in conpty mode and simply returns false to force a pass-through of the mode change. And the `TerminalDispatch` now has its own `SetScreenMode` implementation that tracks any changes to the reversed state, and triggers a redraw in the renderer. To make the renderer work, we just needed to update the `GetForegroundColor` and `GetBackgroundColor` methods of the terminal's `IRenderData` implementation to check the reversed state, and switch the colors being calculated, the same way the `LookupForegroundColor` and `LookupBackgroundColor` methods work in the conhost `Settings` class. ## Validation Steps Performed I've manually tested the `DECSCNM` functionality for Windows Terminal in Vttest, and also with some of my own test scripts.
claunia added the pull-request label 2026-01-31 09:18:09 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26788