zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 689f3163af48fd6e0c08bb76fadfb711db30c97c (tree)
parent 9e0ac4449a18677ba695f7a75342cbdb049aad52
Author: Ryan Liptak <squeek502@hotmail.com>
Date:   Sat,  1 Jul 2023 20:41:12 -0700

Fix `TTY.detectConfig` regression on windows

e05412669c8dde1230612de5af64fbc3fb0bc17e 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.

Diffstat:
Mlib/std/io/tty.zig | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/std/io/tty.zig b/lib/std/io/tty.zig @@ -20,6 +20,8 @@ pub fn detectConfig(file: File) Config { if (force_color == false) return .no_color; + if (file.supportsAnsiEscapeCodes()) return .escape_codes; + if (native_os == .windows and file.isTty()) { var info: windows.CONSOLE_SCREEN_BUFFER_INFO = undefined; if (windows.kernel32.GetConsoleScreenBufferInfo(file.handle, &info) != windows.TRUE) { @@ -31,11 +33,7 @@ pub fn detectConfig(file: File) Config { } }; } - if (force_color == true or file.supportsAnsiEscapeCodes()) { - return .escape_codes; - } - - return .no_color; + return if (force_color == true) .escape_codes else .no_color; } pub const Color = enum {