Progress: refactor

This commit is contained in:
zvon 2020-01-15 17:45:29 +01:00
parent bae6f47bc5
commit d9351c583f

View File

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