From 2bd0b12cb367aa8443ae31f4a3957040bcc1a5b0 Mon Sep 17 00:00:00 2001 From: Fred Emmott Date: Wed, 12 Aug 2026 08:59:47 -0500 Subject: [PATCH 1/2] Replace `\e` with `\033` refs #704 Modern Windows terminals support these escape sequences, but MSVC does not recognize `\e` as a valid escape sequence --- src/display.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index 4b10a598a..0ba89243e 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -23,7 +23,7 @@ void printError(const std::string &err, bool eol) { if (isatty(STDERR_FILENO)) - std::cerr << KRED << err << "\e[0m"; + std::cerr << KRED << err << "\033[0m"; else std::cerr << err; std::cerr << std::flush; @@ -34,7 +34,7 @@ void printError(const std::string &err, bool eol) void printWarn(const std::string &warn, bool eol) { if (isatty(STDOUT_FILENO)) - std::cout << KYEL << warn << "\e[0m" << std::flush; + std::cout << KYEL << warn << "\033[0m" << std::flush; else std::cout << warn; std::cout << std::flush; @@ -45,7 +45,7 @@ void printWarn(const std::string &warn, bool eol) void printInfo(const std::string &info, bool eol) { if (isatty(STDOUT_FILENO)) - std::cout << KBLUL << info << "\e[0m" << std::flush; + std::cout << KBLUL << info << "\033[0m" << std::flush; else std::cout << info; std::cout << std::flush; @@ -56,7 +56,7 @@ void printInfo(const std::string &info, bool eol) void printSuccess(const std::string &success, bool eol) { if (isatty(STDOUT_FILENO)) - std::cout << KGRN << success << "\e[0m" << std::flush; + std::cout << KGRN << success << "\033[0m" << std::flush; else std::cout << success; std::cout << std::flush; From 3a81f8b81102fced943f62d7ac18bf3b5c0e6b38 Mon Sep 17 00:00:00 2001 From: Fred Emmott Date: Wed, 12 Aug 2026 10:38:06 -0500 Subject: [PATCH 2/2] Portable `isatty()` check in progressBar - POSIX, Linux: returns 0 or 1 - MSDN `_isatty()` (isatty is macro for that): returns 0 or non-zero. In Windows Terminal, it's returning 64 for me Other calls are only checking truthiness, not explicitly for 1 refs #704 --- src/progressBar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/progressBar.cpp b/src/progressBar.cpp index c25ea3a5a..73e2d15e6 100644 --- a/src/progressBar.cpp +++ b/src/progressBar.cpp @@ -17,7 +17,7 @@ ProgressBar::ProgressBar(const std::string &mess, int maxValue, int progressLen, bool quiet): _mess(mess), _maxValue(maxValue), _progressLen(progressLen), last_time(std::chrono::system_clock::now()), _quiet(quiet), _first(true), - _is_tty(_force_terminal_mode || isatty(STDOUT_FILENO) == 1) + _is_tty(_force_terminal_mode || isatty(STDOUT_FILENO)) { }