[PR #17845] Pass through DCS responses when VT input mode is disabled #31387

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

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

State: closed
Merged: Yes


Summary of the Pull Request

When an app makes a VT request that returns a DCS response, and it
hasn't also enabled VT input mode, the new passthrough implementation
loses that response. All the app receives is an Alt+\ key press
triggered by the ST terminator. This PR fixes that issue.

References and Relevant Issues

This is one of the unresolved issues tracked in #17643.

Detailed Description of the Pull Request / Additional comments

The way DCS sequences are handled in the input state machine engine is
by returning a nullptr from ActionDcsDispatch, which tells the state
machine to ignore that content. But the sequence is still buffered, and
when the ST terminator is eventually received, that buffer is flushed,
which passes the whole thing through to the app.

Originally this only worked when VT input mode was enabled, otherwise
the ST sequence is converted into a key press, and the buffered DCS
content is lost. The way it works now is we set a flag when the DCS
introducer is received, and if that flag is set when the ST arrives,
we know to trigger a flush rather a key press.

Validation Steps Performed

I've tested a DA3 request from the cmd shell (i.e. echo ^[[=c), and
confirmed that now works as expected. I've also hacked Windows Terminal
to disable win32-input mode, so I could check how it works with conpty
clients generating standard VT input, and confirmed that an Alt+\
keypress is still translated correctly.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/17845 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request When an app makes a VT request that returns a `DCS` response, and it hasn't also enabled VT input mode, the new passthrough implementation loses that response. All the app receives is an `Alt`+`\` key press triggered by the `ST` terminator. This PR fixes that issue. ## References and Relevant Issues This is one of the unresolved issues tracked in #17643. ## Detailed Description of the Pull Request / Additional comments The way `DCS` sequences are handled in the input state machine engine is by returning a nullptr from `ActionDcsDispatch`, which tells the state machine to ignore that content. But the sequence is still buffered, and when the `ST` terminator is eventually received, that buffer is flushed, which passes the whole thing through to the app. Originally this only worked when VT input mode was enabled, otherwise the `ST` sequence is converted into a key press, and the buffered `DCS` content is lost. The way it works now is we set a flag when the `DCS` introducer is received, and if that flag is set when the `ST` arrives, we know to trigger a flush rather a key press. ## Validation Steps Performed I've tested a `DA3` request from the cmd shell (i.e. `echo ^[[=c`), and confirmed that now works as expected. I've also hacked Windows Terminal to disable win32-input mode, so I could check how it works with conpty clients generating standard VT input, and confirmed that an `Alt`+`\` keypress is still translated correctly.
claunia added the pull-request label 2026-01-31 09:46:55 +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#31387