-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConPTY modifies escape sequences passed to process input #12166
Comments
I think it depends not on the terminal, but on what is running in it. For example in PSReadline
And
In cmd
|
Nice example, it also prints for me
output would be:
This is because When |
Is this input? PS > "`e[5D_2345" | pwsh -c { [console]::CursorLeft = 5; $input }
_2345
PS > "`e[5D_2345" | pwsh -c { [console]::CursorLeft = 10; $input }
_2345 |
@237dmitry I guess no, because in this case
You can try MiniTerm and replace |
Perhaps I've misunderstood your problem, but it sounds to me like you're confusing input and output sequences. On a Unix system, trying running The sequence |
@j4james Thanks for the reply. Putting aside what the proper escape sequence for |
When you're connecting through conpty, it needs to process your input before forwarding it on to the hosted application or shell. Bear in mind that the process on the other end might be a legacy Windows app, expecting to receive So what happens when conpty tries to process your Eventually it'll get to a point where it needs to generate an appropriate pair of I'm not overly familiar with this area of the code, so I might have some of the details wrong, but I think that's the gist of it. |
@j4james Thanks for the details. I've replaced |
FWIW the version of ConPTY shipped in the OS lags behind the version in Terminal by quite a few months. The version that ships with Terminal (which we're hoping to pull out into a nuget package or something) does pass through all VT input unchanged, if the application on the other end is in |
@DHowett Awesome, thanks! ENABLE_VIRTUAL_TERMINAL_INPUT is on by default in my case. I guess this can be closed now. |
@Sergey just to close the loop, this landed in #4856, and was fixed in a couple subsequent PRs. :) We initially added it so that a compliant terminal emulator could generate mouse input that we would pass through to an application such that that we didn't have to add a bidirectional mouse input translator. 😄 |
Windows Terminal version
1.11.3471.0 (not sure Windows Terminal version matters)
Windows build number
10.0.22000.434
Other Software
No response
Steps to reproduce
Thanks for ConPTY, it's great! I'm developing a terminal emulator using ConPTY API to start a shell process and I've come across the following problem: when Ctrl+Left is pressed,
ESC [ 5 D
bytes are written to shell's input stream. However, shell sees it asESC [ D
. It's reproduced whencmd.exe
orpowershell.exe
is used as a shell, but works correctly withwsl.exe
. Is it a known issue?More detailed steps to reproduce:
cmd.exe
will be started.writer.Write("\x001b[5D")
withwriter.Write("\x001b[1;5D")
, Ctrl+Left works correctly, but I'd like to keep the same logic for Unix and Windows, because\x001b[5D
works on Unix correctly.Expected Behavior
The original escape sequence should be passed to shell:
ESC [ 5 D
Actual Behavior
Cut escape sequence is passed to shell:
ESC [ D
The text was updated successfully, but these errors were encountered: