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

ANSI Escape Sequence Handling Issue #11848

Closed
andrewraddatz opened this issue Nov 30, 2021 · 6 comments
Closed

ANSI Escape Sequence Handling Issue #11848

andrewraddatz opened this issue Nov 30, 2021 · 6 comments
Labels
Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Product-Terminal The new Windows Terminal. Resolution-External For issues that are outside this codebase

Comments

@andrewraddatz
Copy link

Windows Terminal version

1.12.211020001-release1.12

Windows build number

10.0.19041.0

Other Software

julia version 1.6 and above

Steps to reproduce

Launch julia inside of Windows Terminal

Expected Behavior

Launching julia outside of Windows Terminal with Legacy Console Mode enabled:

image

Windows Terminal should render the ANSI escapes as above.

Actual Behavior

When julia is launched in Windows Terminal, ANSI escapes are printed directly to the screen.

In Windows Terminal, launched from pwsh:
image

In Windows Terminal, launched from pwsh (julia --color=no):
image

In Windows Terminal, launched as a new tab:
image

In Windows Terminal, launched as a new tab (julia --color=no):
image

Launched directly, Legacy Console Mode disabled:
image

@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 Nov 30, 2021
@zadjii-msft
Copy link
Member

(glad you made it from stackoverflow ☺️)

HUH. I wonder if they're setting the VT reg key.

Can you export the contents of HKCU\Console to a .reg file, rename it to .txt, and share it here?
image

I'm guessing that there's a VirtualTerminalLevel that's set to something other than 0, and they're using that to manually enable VT support, rather than using SetConsoleMode

@zadjii-msft zadjii-msft added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Nov 30, 2021
@andrewraddatz
Copy link
Author

Here's the output with a few non-relevant applications removed from the list.

console.txt

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Nov 30, 2021
@zadjii-msft
Copy link
Member

zadjii-msft commented Nov 30, 2021

You know what, I'm smarter than that. When julia is working correctly, are you launching it from a shortcut? Something like julia.lnk, either on the desktop, or the Taskbar, or the Start Menu?

There are two places that a console app can have VirtualTerminalLevel set - one is in the registry, the other is in the lnk. Though, I didn't.... (thought clipped in favor of another theory)

Presumably, using the run dialog (win+r) to launch v:\PortableApps\julia\bin\julia.exe would also not work.

// microsoft/terminal#1965 - Let's just always enable VT processing by
// default for conpty clients. This prevents peculiar differences in
// behavior between conhost and terminal applications when the user has
// VirtualTerminalLevel=1 in their registry.
// We want everyone to be using VT by default anyways, so this is a
// strong nudge in that direction. If an application _doesn't_ want VT
// processing, it's free to disable this setting, even in conpty mode.
settings.SetVirtTermLevel(1);

We should be enabling virtual terminal processing for Terminal client apps, always. That implies that julia is actually _manually disabling it?!

https://github.com/JuliaLang/julia/blob/f9bb6f8fa8c66ca00f215cbbc4e4bc5addc43156/stdlib/REPL/src/LineEdit.jl#L1375

That's the only SetConsoleMode reference in julia. Maybe there's something else I'm missing.

x-ref: JuliaLang/julia#43273

PR that added the SetConsoleMode call: JuliaLang/julia#36598

@andrewraddatz
Copy link
Author

I don't launch it through a link. In Windows Terminal, the settings are done this way:

image
image

Otherwise, I use start v:\PortableApps\julia\bin\julia.exe to launch it.

@andrewraddatz
Copy link
Author

After the problem magically resolving itself when i moved my ~/.julia directory, I did some more digging. It looks like the issue is tied to a macro that I created to clear the screen which was called in a different macro in my startup script.

replacing the macro with its content removes the ANSI character issue.

@zadjii-msft
Copy link
Member

Well, that's good to know. Thanks for following up!

@zadjii-msft zadjii-msft added Product-Terminal The new Windows Terminal. Resolution-External For issues that are outside this codebase labels Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Product-Terminal The new Windows Terminal. Resolution-External For issues that are outside this codebase
Projects
None yet
Development

No branches or pull requests

2 participants