From 9f3f95d61158d704bebf1c9bf8e859b73ecb2832 Mon Sep 17 00:00:00 2001 From: modeco80 Date: Tue, 22 Aug 2023 17:06:36 -0400 Subject: [PATCH] oops --- src/fprint.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fprint.hpp b/src/fprint.hpp index 22e5bc0..b494fb5 100644 --- a/src/fprint.hpp +++ b/src/fprint.hpp @@ -36,8 +36,13 @@ namespace swbf { template inline void fprint(std::FILE* file, std::string_view format, Args&&... args) { #ifdef _WIN32 + // windows vt handling is DOG slow. don't know why lmao auto str = std::vformat(format, std::make_format_args(args...)); - WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), str.data(), str.length(), nullptr, nullptr); + HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); + if(file == stderr) + handle = GetStdHandle(STD_ERROR_HANDLE); + + WriteConsole(handle, str.data(), str.length(), nullptr, nullptr); #else std::vformat_to(FputcIterator(file), format, std::make_format_args(args...)); #endif