-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the DECRQM escape sequence (#14444)
This PR adds support for the `DECRQM` (Request Mode) escape sequence, which allows applications to query the state of the various modes supported by the terminal. It also adds support for the `DECNKM` mode, which aliases the existing `DECKPAM` and `DECKPNM` operations, so they can be queried with `DECRQM` too. This is one solution for #10153 (saving and restoring the state of bracketed paste mode), and should also help with #1040 (providing a way for clients to determine the capabilities of the terminal). Prior to adding `DECRQM`, I also did some refactoring of the mode handling to get rid of the mode setting methods in the `ITermDispatch` interface that had no need to be there. Most of them were essentially a single line of code that could easily be executed directly from the `_ModeParamsHelper` handler anyway. As part of this refactoring I combined all the internal `AdaptDispatch` modes into an `enumset` to allow for easier management, and made sure all modes were correctly reset in the `HardReset` method (prior to this, there were a number of modes that we weren't restoring when we should have been). And note that there are some differences in behavior between conhost and Windows Terminal. In conhost, `DECRQM` will report bracketed paste mode as unsupported, and in Terminal, both `DECCOLM` and `AllowDECCOLM` are reported as unsupported. And `DECCOLM` is now explicitly ignored in conpty mode, to avoid the conpty client and conhost getting out of sync. ## Validation Steps Performed I've manually confirmed that all the supported modes are reported in the `DECRQM` tests in Vttest, and I have my own test scripts which I've used to confirm that `RIS` is now resetting the modes correctly. I've also added a unit test in `AdapterTest` that iterates through the modes, checking the responses from `DECRQM` for both the set and reset states. I should also mention that I had to do some refactoring of the existing tests to compensate for methods that were removed from `ITermDispatch`, particularly in `OutputEngineTest`. In many cases, though, these tests weren't doing much more than testing the test framework.
- Loading branch information
Showing
20 changed files
with
437 additions
and
813 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
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
Oops, something went wrong.