From 11b9f3ebe2686e18e6e7410b95cd1d38068048ff Mon Sep 17 00:00:00 2001 From: Nils Maier Date: Tue, 12 Jun 2012 21:58:38 +0200 Subject: [PATCH] Detect console with on Windows Signed-off-by: Nils Maier --- src/ConsoleStatCalc.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ConsoleStatCalc.cc b/src/ConsoleStatCalc.cc index 74c322cd..9e02aa46 100644 --- a/src/ConsoleStatCalc.cc +++ b/src/ConsoleStatCalc.cc @@ -296,6 +296,11 @@ ConsoleStatCalc::calculateStat(const DownloadEngine* e) cols = std::max(0, (int)size.ws_col-1); } #endif // HAVE_TERMIOS_H +#else // __MINGW32__ + CONSOLE_SCREEN_BUFFER_INFO info; + if(::GetConsoleScreenBufferInfo(::GetStdHandle(STD_OUTPUT_HANDLE), &info)) { + cols = std::max(0, info.dwSize.X - 2); + } #endif // !__MINGW32__ std::string line(cols, ' '); global::cout()->printf("\r%s\r", line.c_str());