Skip to content

Commit 689f316

Browse files
squeek502andrewrk
authored andcommitted
Fix TTY.detectConfig regression on windows
e054126 inadvertently changed the logic on Windows and made it so that supportsAnsiEscapeCodes was never checked. This fixes that regression while keeping the logic intact for other platforms.
1 parent 9e0ac44 commit 689f316

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/std/io/tty.zig

+3-5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ pub fn detectConfig(file: File) Config {
2020

2121
if (force_color == false) return .no_color;
2222

23+
if (file.supportsAnsiEscapeCodes()) return .escape_codes;
24+
2325
if (native_os == .windows and file.isTty()) {
2426
var info: windows.CONSOLE_SCREEN_BUFFER_INFO = undefined;
2527
if (windows.kernel32.GetConsoleScreenBufferInfo(file.handle, &info) != windows.TRUE) {
@@ -31,11 +33,7 @@ pub fn detectConfig(file: File) Config {
3133
} };
3234
}
3335

34-
if (force_color == true or file.supportsAnsiEscapeCodes()) {
35-
return .escape_codes;
36-
}
37-
38-
return .no_color;
36+
return if (force_color == true) .escape_codes else .no_color;
3937
}
4038

4139
pub const Color = enum {

0 commit comments

Comments
 (0)