-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Virtual Terminal Sequences for Simple Cursor Positioning don't work #11005
Comments
You need to contend with the fact that in C# the D is viewed as a hex digit and it is taken as part of the \x1bD. I suggest you try a simple \x08 to get the backspace you want in this particular case. Or use the official VT escape sequence. |
Or tell it where the escape sequence ends: |
Or use a less troublesome version.
|
Interesting point about the To double check, I tried the following program: println!("Hello, world!\x1b[D?");
println!("Hello, world!\x1bD?");
print!("Hello, world!\x1b");
print!("D");
println!("?"); I see the following output in the integrated terminal in VS Code:
And the following output in Windows terminal:
(The text keeps going to the right because I also set So in the integrated terminal in VS Code, |
I hunted around in the source code a bit and I found the following leads in
It appears that the simple cursor positioning codes from the article on docs.microsoft.com are simply not implemented in Windows terminal? Maybe because Windows terminal chooses to emulate a different terminal than described in that article? |
Thanks. I'm not blocked on this, since How I run into this: When researching the Windows Console API docs.microsoft.com, I came across the recommendation to discontinue use of the classic console API which links to the documentation about virtual terminal sequences as a more modern and platform-independent replacement. And that documentation first introduces the It is unfortunate that the documentation leads developers into experimenting with virtual terminal sequences which are not support by Windows terminal. Since they are documented there, I assume they are "official VT escape sequences", though. |
Sorry for the confusion, but that's a mistake in the documentation. The first four "Simple Cursor Positioning" commands are actually VT52 sequences that only active in VT52 mode. In the default "ANSI" mode, they mean something completely different, although the only one that's currently implemented is |
Thanks @j4james, that makes sense. So the proper fix is to update the documentation. To my delight, I see that it is also on github, so I opened a PR. Interesting to see what will come of it. |
Hmm wait this doesn't explain why the terminal integrated into VS Code interpretes the codes differently than Windows Terminal. Do they use different default configurations? Why? |
The behavior described in the documentation is the way the code used to work. That was corrected a while back, but those corrections take a while to make their way into the conhost that is included with Windows itself. Windows Terminal bundles its own build of conhost, so it always has the latest fixes. I'm guessing VS Code just uses the conhost included with Windows, or at least is not using the most recent version. |
Yep- VS Code uses the version of conhost that ships with Windows. James, I found that you noted this change in the Compatibility section of your spec document when you originally gave us VT52 support. I'm eternally grateful that we've written so much stuff down. @Toxaris sorry about the documentation miss, and thank you for bringing it to our attention 😄 I'll close this one out when we merge the updated docs! |
Windows Terminal version (or Windows build number)
10.0.19042.1165
Other Software
No response
Steps to reproduce
Activate virtual terminal processing and print
"Hello, world!\x1bD?"
to stdout.Expected Behavior
Based on the documentation about virtual terminal sequences for simple cursor positioning I expect to see:
That is, I expect that
\x1bD
moves the cursor left over the!
and then the?
is printed over the!
.In other words, I expect that
\x1bD
works like\x1b[1D
.Actual Behavior
I see:
The text was updated successfully, but these errors were encountered: