diff --git a/progress.cpp b/progress.cpp index 0797095..c1dbeec 100644 --- a/progress.cpp +++ b/progress.cpp @@ -21,19 +21,21 @@ using string = std::string; #endif // UNIX -size_t getTermWidth() { #ifdef WIN32 +size_t getTermWidth() { CONSOLE_SCREEN_BUFFER_INFO csbi; GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), &csbi ); return csbi.srWindow.Right - csbi.srWindow.Left + 1; +} #else +size_t getTermWidth() { struct winsize w; ioctl( 0, TIOCGWINSZ, &w ); return w.ws_col; -#endif } +#endif #ifdef WIN32 void home( size_t /*UNUSED*/ ) {