| author | |
| committer | |
| log | 59a12cd293a6d84090071b0ebb4828cd6626e079 |
| tree | ffd9c8ead24d8577ace22fc3a91c1832b90e39e4 |
| parent | 729a051e9e38674233190aea23c0ac8c134f2d67 |
2 files changed, 9 insertions(+), 0 deletions(-)
lib/std/fs/file.zig+7| ... | ... | @@ -230,6 +230,13 @@ pub const File = struct { |
| 230 | 230 | /// Test whether ANSI escape codes will be treated as such. |
| 231 | 231 | pub fn supportsAnsiEscapeCodes(self: File) bool { |
| 232 | 232 | if (builtin.os.tag == .windows) { |
| 233 | if (!os.isatty(self.handle)) return false; | |
| 234 | ||
| 235 | var console_mode: os.windows.DWORD = 0; | |
| 236 | if (os.windows.kernel32.GetConsoleMode(self.handle, &console_mode) != 0) { | |
| 237 | if (console_mode & os.windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING != 0) return true; | |
| 238 | } | |
| 239 | ||
| 233 | 240 | return os.isCygwinPty(self.handle); |
| 234 | 241 | } |
| 235 | 242 | if (builtin.os.tag == .wasi) { |
lib/std/os/windows.zig+2| ... | ... | @@ -3387,6 +3387,8 @@ pub const CONSOLE_SCREEN_BUFFER_INFO = extern struct { |
| 3387 | 3387 | dwMaximumWindowSize: COORD, |
| 3388 | 3388 | }; |
| 3389 | 3389 | |
| 3390 | pub const ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x4; | |
| 3391 | ||
| 3390 | 3392 | pub const FOREGROUND_BLUE = 1; |
| 3391 | 3393 | pub const FOREGROUND_GREEN = 2; |
| 3392 | 3394 | pub const FOREGROUND_RED = 4; |