-
-
Notifications
You must be signed in to change notification settings - Fork 21.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
[Windows, 4.0] Detect new Windows Terminal and disable unsupported set_console_visible code. #55966
The head ref may contain hidden characters: "wt\u{1F4A9}4"
Conversation
…sole_visible code.
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); | ||
DWORD dwMode = 0; | ||
if (GetConsoleMode(hStdOut, &dwMode)) { | ||
return ((dwMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING) == ENABLE_VIRTUAL_TERMINAL_PROCESSING); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if I understand it right, this is mostly a heuristic: ENABLE_VIRTUAL_TERMINAL_PROCESSING was added for the Windows Terminal in the Windows 10 Anniversary update, and isn't enabled by default in the legacy console, but is enabled by default in Windows Terminal.
Thus we can check if it is enabled and assume we're likely running in a Windows Terminal. In theory, we could also be running in another console that has this turned on manually.
This looks acceptable to me, but maybe we could have a comment explaining/documenting this? Maybe we also want to link to the original Github issue for future readers. (#54076)
That would
- explain this/make it more readable
- ensure we remember to remove it if this is fixed/not revelant anymore upstream
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a short comment sounds good yeah. The issue can be referenced as GH-54076
in text, that's how I do it usually (it's easy enough to get to the URL from there, without having to hardcode all kinds of github.com all over the place).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That being said, we might prefer to wait for the approach taken in #55987 and thus only merge this workaround for 3.4
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! |
set_console_visible
/Toggle System Console
when using new Windows Terminal.Tested on Windows 11 21H1(22000.348) with:
Bugsquad edit: Closes #55971.