Skip to content
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 VS Code Issue - ANSI escape sequences don't display correctly #12806

Closed
rewrking opened this issue Apr 1, 2022 · 11 comments
Closed

ConPTY VS Code Issue - ANSI escape sequences don't display correctly #12806

rewrking opened this issue Apr 1, 2022 · 11 comments
Labels
Area-VT Virtual Terminal sequence support Issue-Bug It either shouldn't be doing this or needs an investigation. Issue-Question For questions or discussion Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Product-Conpty For console issues specifically related to conpty Resolution-Answered Related to questions that have been answered

Comments

@rewrking
Copy link

rewrking commented Apr 1, 2022

Windows Terminal version

1.13.10733.0

Windows build number

10.0.19041.1415

Other Software

VS Code 1.66.0

Steps to reproduce

  1. Open VS Code and set "terminal.integrated.minimumContrastRatio": 1:
  2. Get this file: https://gist.github.com/rewrking/f797bd19e9ecc44fa1c646b3f7b795c0

Steps for Git Bash inside of VS Code:

  1. Run cat print_term.txt where the file in step 3 was saved

Steps for Powershell inside of VS Code:

  1. Run Get-Content -Path .\print_term.txt where the file in step 3 was saved

Expected Behavior

All terminal colors and most ansi sequences would be expected, but this is not the case.

Actual Behavior

Right now, my VS Code and Windows Terminal setup use the same color scheme. Both Git Bash and Powershell display the same way in each. In order to test this correctly, all 16 colors need to be unique.

This is what displays in VS Code on Windows:

ansi_vscode

This is what displays in Windows Terminal:

ansi_windows_terminal

I originally opened up this issue with the vscode team, but they closed the issue and told me to take it up with you folks, due to the problem being related to conPTY:
microsoft/vscode#146474

Let me know if there's a way to fix this. Thanks.

@rewrking rewrking added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Apr 1, 2022
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Apr 1, 2022
@zadjii-msft
Copy link
Member

I believe that this is something that's already fixed in newer OS builds:

image

The Terminal ships with an up-to-date ConPTY in the package, but VsCode needs to rely on the version that's shipped with the OS. I'm not totally sure which OS version these attributes started being supported in. I'd bet somewhere >=22000.

@zadjii-msft zadjii-msft added Issue-Question For questions or discussion Product-Conpty For console issues specifically related to conpty Area-VT Virtual Terminal sequence support Resolution-Answered Related to questions that have been answered labels Apr 1, 2022
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Apr 1, 2022
@rewrking
Copy link
Author

rewrking commented Apr 1, 2022

Is that an insiders version of Windows 10? Mine is supposedly up to date.

@zadjii-msft
Copy link
Member

Nah, 22000+ builds are all Windows 11

@rewrking
Copy link
Author

rewrking commented Apr 1, 2022

Is there a file or something I can manually update instead? Is ConPTY a dll?

@zadjii-msft
Copy link
Member

ConPTY is actually just something that's built into conhost.exe itself.

You might be able to copy-paste a conhost from a Windows 11 machine onto a Windows 10 one, and it probably would work fine. That being said, there was another thread just this week about someone who was tying to move a conhost.exe between machines and experiencing quite a bit of difficulty. I wouldn't recommend it. If you try replacing your c:\windows\system32\conhost.exe and it DOESNT work, then you'll be totally unable to run any commandline applications. Big ol

HERE BE DRAGONS

@rewrking
Copy link
Author

rewrking commented Apr 1, 2022

Hahaha understood. Ugh. Thanks.

@rewrking
Copy link
Author

rewrking commented Apr 1, 2022

Okay, so one more thing: What does Windows Terminal do differently? Does it link those conhost changes from a static library during its build or something?

@rewrking
Copy link
Author

rewrking commented Apr 1, 2022

HERE BE DRAGONS

Yep. This worked (also made sure ConhostV1.dll was copied just in case). Thanks!

@zadjii-msft
Copy link
Member

Okay, so one more thing: What does Windows Terminal do differently? Does it link those conhost changes from a static library during its build or something?

Sorta - Terminal actually just includes a whole conhost in its package, and doesn't directly call the conpty apis - it calls a slightly different version that calls into the conhost shipped in the package rather than the one in the OS.

@Mingun
Copy link

Mingun commented Jul 1, 2022

ConPTY is actually just something that's built into conhost.exe itself.

You might be able to copy-paste a conhost from a Windows 11 machine onto a Windows 10 one, and it probably would work fine. That being said, there was another thread just this week about someone who was tying to move a conhost.exe between machines and experiencing quite a bit of difficulty. I wouldn't recommend it. If you try replacing your c:\windows\system32\conhost.exe and it DOESNT work, then you'll be totally unable to run any commandline applications. Big ol

HERE BE DRAGONS

Whats happens if I copy conhost.exe from Windows 11 to Windows 7 and it will not work? Will I able to return Windows 7 conhost.exe back from backup? Or system will be broken and I cannot run any application? Can I somehow check is this will work before reloading system?

@DHowett
Copy link
Member

DHowett commented Jul 1, 2022

Whats happens if I copy conhost.exe from Windows 11 to Windows 7 and it will not work?

It will not work, and you risk breaking your system. I wouldn't even try it. The version of conhost on Windows 7 uses a different communication protocol.

We used to verify conhost.exe down to Windows 8.1. That was the first version that used the new communication protocol.

It technically still works, but there are some minor DLL incompatibilities that would need to be worked around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-VT Virtual Terminal sequence support Issue-Bug It either shouldn't be doing this or needs an investigation. Issue-Question For questions or discussion Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Product-Conpty For console issues specifically related to conpty Resolution-Answered Related to questions that have been answered
Projects
None yet
Development

No branches or pull requests

4 participants