-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
Ansi codes are displayed instead of formatting text #11449
Comments
I don't understand that you compare.
So we have 4 cases for comparison. |
Sorry if I wasn't clear, that's on me. Windows has 4 diff command lines? 😵 Here's my problem: my lib claims that a dev can use it to format the text the send to a command line. Right now, it "just works" on Linux and macOS, so I don't need to issue any requirements to devs. So what are the requirements for it to work on Windows?
Regarding PS6 vs PS7, I installed PS6 this month. The only reason I didn't go for PS7 was because at the time it was on "Preview". Is it safe/stable to switch? Again, I'll use whatever you advise me to. |
I don't understand why Windows PowerShell is on right side of your screenshot. |
What is it that you don't understand? Can you be more precise? On the right I have Windows Terminal, because I read somewhere that it was the "new and best" cli for Win. I don't know why Windows Terminal opens a PowerShell tab, your team mates might. Did you read any of my previous questions? I'll try to be even more precise: What is the standard or officially recommended cli for (Java) developers on Windows 10? |
@dialex It isn't a powershell thing. If your windows build is before 18298 the terminal doesn't support ansi codes. It doesn't matter if you run CMD, Windows PowerShell (5), PowerShell core (6) or the preview of 7, it's like the 1980s DOS without loading ANSI.SYS. If you have a 18298 or later OR if you install the new Windows terminal, again CMD, Windows PowerShell or PowerShell core. will all display as you want. The new terminal will do it better and a lot faster. It creates confusion when you say PowerShell core 6 in an old terminal doesn't do X but the older Windows PowerShell 5 in the new terminal does it.
|
@dialex For classic Windows console you should continue to use Jansi. New Windows terminal supports escapes and you can remove Jansi. |
Hold up, what?
This is entirely incorrect: the in-box standard windows console has supported ANSI (really, Xterm and VT100) since build 10240, which shipped almost four years ago. The screenshot seems to show an application (java) not enabling Jansi probably enables that console mode, which is why it makes this work. God, I hope so: if it’s parsing VT sequences on its own it’s going to be terrible. |
I’d love to learn which piece of documentation told you that 18298 was the build that enabled ANSI, so that my team can go fix it. EDIT: looks like that’s our blog, but somebody has misinterpreted the feature we were releasing. That isn’t “experimental support for ANSI”, that is “experimental support for a split color palette and configurable cursor types” |
I'll put my hand up if I misread that... knowing it hasn't always worked but has worked for a decent length of time I went back to check and got the wrong info, if I'd thought a bit harder it should have dawned on me that the post was much too late a date. But I think I reposted an error rather than making a whole new one |
@jhoneill my bad. Thanks for clarifying :) Yeah, it looks like a classic error-carried-forward. |
That's my suspicion too @DHowett-MSFT (also thanks for joining the thread) 🙇 I'll try to enable it and report back the results.
Yup, I'm confused as well. I tried PS5, PS6, cmd inside this new Windows Terminal and all showed color ✅However, when I run them individually (outside Win Terminal) they don't show color ❌ If all fails, I can just recommend my devs to use Windows Terminal. 🤷♂ Is that fair? With so many Win clis, what is the officially recommended cli for developers on Windows 10?
|
UPDATE: I enabled the feature, and now both PowerShell and Command Prompt display colors 😍 For reference, here's how to enable |
Steps to reproduce
Expected behavior
The output is colored (both font and background)
Actual behavior
The output is not colored, and shows Ansi codes
Context
This is how it looks on Windows PS6 vs Windows Terminal (maybe you can reach out to your fellow teammates and ask what they're doing differently):
I'm the maintainer of JCDP, a java lib to print formatted output on terminals. For that it uses standard Ansi codes. On Linux/Mac it always worked fine. On Windows, I had to depend on Jansi to convert those Ansi codes to something Windows friendly.
I read that Win10 now supports Ansi codes, so I removed the Jansi dependency (dialex/JColor#25) and tried to run the lib again. Sadly it didn't work on Win PS6... I'm not sure why. Is it because I need to enable the "Virtual Terminals" feature? Then why does it work out of the box for Win Terminal?
The text was updated successfully, but these errors were encountered: