mirror of https://github.com/aria2/aria2
Detect console with on Windows
Signed-off-by: Nils Maier <maierman@web.de>pull/48/head
parent
a49397ed19
commit
11b9f3ebe2
|
@ -296,6 +296,11 @@ ConsoleStatCalc::calculateStat(const DownloadEngine* e)
|
||||||
cols = std::max(0, (int)size.ws_col-1);
|
cols = std::max(0, (int)size.ws_col-1);
|
||||||
}
|
}
|
||||||
#endif // HAVE_TERMIOS_H
|
#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__
|
#endif // !__MINGW32__
|
||||||
std::string line(cols, ' ');
|
std::string line(cols, ' ');
|
||||||
global::cout()->printf("\r%s\r", line.c_str());
|
global::cout()->printf("\r%s\r", line.c_str());
|
||||||
|
|
Loading…
Reference in New Issue