Uh oh!
There was an error while loading. Please reload this page.
windows: detect ANSI support in more terminals - #15282
Conversation
perillo
commented
Apr 18, 2023
@nolanderc Does #15206 fix this issue? |
nolanderc
commented
Apr 18, 2023
perillo
commented
Apr 18, 2023
Color codes are all hardcoded. On Windows we have: and on an ANSI compatible terminal, we have that corresponds to white color with bold or increased intensity. So it seems the issue is the use of ANSI colors on a terminal having a white background/light color theme. |
nolanderc
commented
Apr 19, 2023
Ah yes, I seem to have forgotten to add a line to my commit... Originally, I had intended to split the |
nolanderc
commented
Apr 19, 2023
Nevermind, that was already there... 😅 |
I am in full support of this. @nolanderc you might want to rebase this branch on latest master so that it passes CI to make it more likely to get merged. The new build runner means that on Windows the With the changes in this PR, the colors are preserved (at least with Windows Terminal). Before this PR: After this PR: |
| /// Test whether ANSI escape codes will be treated as such. | ||
| pub fn supportsAnsiEscapeCodes(self: File) bool { | ||
| if (builtin.os.tag == .windows) { | ||
| if (!os.isatty(self.handle)) return false; |
There was a problem hiding this comment.
This is redundant and can (should?) be removed, the implementation of os.isatty on Windows is:
if (isCygwinPty(handle))
returntrue;
varout: windows.DWORD=undefined;
returnwindows.kernel32.GetConsoleMode(handle, &out) !=0;Closing abandoned PR (CI failures, unaddressed review comments). @squeek502 please feel free to pick this up in a new PR if you are interested. |


Checks if the underlying console supports ANSI escape sequences.
Resolves an issue where bold text would render as completely white in Windows Terminal, which was unreadable on a light background.