Repository navigation
Enable Passthrough for VT Input Mode in ConPty - #4856
Merged
2 commits merged intoMar 10, 2020
Merged
2 commits merged into
2 commits merged into
Conversation
Dustin L. Howett (MSFT) (DHowett-MSFT)
suggested changes
Mar 9, 2020
Mike Griese (zadjii-msft)
requested changes
Mar 10, 2020
Mike Griese (zadjii-msft)
left a comment
Member
There was a problem hiding this comment.
- I'm largely blocking on the same thing Dustin is
- We still need a function in conhost for "I'm in conpty mode, and the client app turned off VT input mode, I need to reset the Terminal's input mode", right?
| if (isPty) | ||
| { | ||
| return false; | ||
| } |
Contributor
There was a problem hiding this comment.
god, this API is needlessly verbose ;)
i hope when somebody fixes IsConsolePty to return a bool, they come fix all of these
Dustin L. Howett (MSFT) (DHowett-MSFT)
approved these changes
Mar 10, 2020
Dustin L. Howett (MSFT) (DHowett-MSFT)
left a comment
Contributor
There was a problem hiding this comment.
This same infrastructure is tested w/ statemachine and OSME; I am comfortable shipping this without a test. Mike?
Mike Griese (zadjii-msft)
approved these changes
Mar 10, 2020
|
Hello Dustin L. Howett (MSFT) (@DHowett-MSFT)! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
ghost
deleted the
dev/cazamor/vtmm/dispatch-and-engine-changes
branch
March 10, 2020 22:07
Abhijeet Viswam (abhijeetviswam)
pushed a commit
to abhijeetviswam/terminal
that referenced
this pull request
Mar 12, 2020
This commit enables passthrough mode for VT Input Mode in ConPty. This will be used to pass VT Input from Mouse Mode directly to the app on the other side. ## References microsoft#545 - VT Mouse Mode (Terminal) microsoft#376 - VT Mouse Mode (ConPty) ## Detailed Description of the Pull Request / Additional comments ### ConHost - Set the callback for the InputEngine. - Retrieve `IsInVirtualTerminalInputMode` from the InputBuffer ### Adapter (Dispatch) Retrieve `VTInputMode` setting from ConHost ### Parser - Add a callback to passthrough unknown input sequences directly to the input queue. - If we're in VTInputMode, use the callback ## Validation Steps Performed Tests should still pass.
Dustin L. Howett (MSFT) (DHowett-MSFT)
pushed a commit
that referenced
this pull request
Mar 13, 2020
## Summary of the Pull Request Make TerminalControl synthesize mouse events and Terminal send them to the TerminalInput's MouseInput module. The implementation here takes significant inspiration from how we handle KeyEvents. ## References Closes #545 - VT Mouse Mode (Terminal) References #376 - VT Mouse Mode (ConPty) ### TerminalControl - `_TrySendMouseEvent` attempts to send a mouse event via TermInput. Similar to `_TrySendKeyEvent` - Use the above function to try and send the mouse event _before_ deciding to modify the selection ### TerminalApi - Hookup (re)setting the various modes to handle VT Input - Terminal is _always_ in VT Input mode (important for #4856) ### TerminalDispatch - Hookup (re)setting the various modes to handle VT Input ### TerminalInput - Convert the mouse input position from viewport position to buffer position - Then send it over to the MouseInput in TerminalInput to actually do it (#4848) ## Validation Steps Performed Tests should still pass.
2 of 3 tasks
ghost
pushed a commit
that referenced
this pull request
Apr 1, 2020
…e's a problem in Win32 quite yet. (#5208) ## Summary of the Pull Request When conpty is in VT input mode, we pass through all the input we receive. This includes all the other `Action*Dispatch` methods, but missed this one. ## References * Missed during #4856 * Discovered during the course of the #4192 review * #5205 Also investigated part of the issue, but found a different bug. ## PR Checklist * [x] Doesn't close anything, just related to above things. * [x] I work here * [ ] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments This will fix the <kbd>ctrl+alt+space</kbd> in the Terminal thing mentioned in #4192, but doesn't actually resolve the root cause of that bug (which is tracked in #5205).
Alistair Smith (alistair-bot)
pushed a commit
to oven-sh/bun
that referenced
this pull request
Sep 20, 2026
…43457) ### Problem - A child spawned with `Bun.spawn({ terminal })` on Windows 10 or Windows Server 2019 writes `\x1b[?1000h\x1b[?1006h` and the sequences never reach the `data` callback. The outer terminal never reports mouse events, so the child never sees a click. Fixes #43450. - The cause is the inbox ConPTY (conhost build 17763 through 19045). It predates [microsoft/terminal#4856](microsoft/terminal#4856), the change that passes VT input mode enables through to the host. Bun calls the kernel32 `CreatePseudoConsole` (`src/runtime/api/bun/Terminal.rs:1170`) and has no way to swap the console host. ### Fix - This PR documents the gap and adds a test. It does not bundle `conpty.dll` and does not add a `conptyDllPath` option. Every Windows channel ships exactly `bun.exe`, and a public option that points at a third-party DLL pair Bun does not ship is a permanent API surface for one reporter. The repo's pattern for conhost 17763 quirks is a build-scoped docs bullet plus a platform gap test, so this PR follows it. - Docs: one bullet in the Platform differences list of `docs/runtime/child-process.mdx`. It names the affected versions, links the upstream change, and notes that Windows 11 and Server 2022 relay the sequences only after the child enables VT input mode (`process.stdin.setRawMode(true)`) before it writes them. - Test: `test/js/bun/terminal/terminal-platform-gaps.test.ts` gains a test that spawns a child that enables raw mode, writes the two DECSET sequences, and asserts they reach the `data` callback. It is a todo on Windows builds before 20348 (Server 2022), so the Server 2019 lane skips it and the Windows 11 lane checks the ordering claim in the docs. - Verified: the test passes on Linux with the debug build and on Windows 11 (build 26100). On Windows Server 2019 (build 17763) it is todo, and with `--todo` its body fails. Ran all of `terminal-platform-gaps.test.ts` on all three. ### Background - ConPTY is the Windows pseudo console. It renders the child's output to a virtual screen inside conhost and emits VT sequences that describe the result. It does not pass bytes through. A DECSET the child writes only reaches the host if conhost chooses to forward it. - Mouse tracking works by a handshake. The child writes `ESC[?1000h` (report clicks) and `ESC[?1006h` (SGR encoding). The outer terminal then writes mouse events to the child's stdin as `ESC[<b;x;yM`. If the enable never reaches the outer terminal, no events flow. - Windows 10 and Server 2019 share the 17763 to 19045 conhost line. microsoft/terminal#4856 merged in March 2020 and shipped in Windows 11 and Server 2022 (build 20348 and later). <details><summary>Notes</summary> Probe on Windows 11 (build 26100, bun 1.4.3): with the child calling `setRawMode(true)` before the DECSET, both sequences reach the `data` callback. Without it, neither does. So the ordering note in the docs is required, and the reporter's `child.mjs` (which writes the DECSET before `setRawMode`) would fail on Windows 11 too. Probe on Windows Server 2019 (build 17763): the sequences are absent in both orderings. `ESC[?25l` (cursor hide) from the same child does arrive, so the drop is specific to the input mode enables. The todo threshold is build 20348 (Server 2022), the first inbox conhost line that carries the upstream change. Windows 10 builds 19041 through 19045 share the older conhost and stay todo. </details>
This pull request was closed.
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.
This commit enables passthrough mode for VT Input Mode in ConPty. This
will be used to pass VT Input from Mouse Mode directly to the app on the
other side.
References
#545 - VT Mouse Mode (Terminal)
#376 - VT Mouse Mode (ConPty)
Detailed Description of the Pull Request / Additional comments
ConHost
IsInVirtualTerminalInputModefrom the InputBufferAdapter (Dispatch)
Retrieve
VTInputModesetting from ConHostParser
input queue.
Validation Steps Performed
Tests should still pass.