9 #if defined(__linux__) || defined(__APPLE__) 
   10 #    include <sys/ioctl.h> 
   18 #ifdef UNIT_TEST_BUILD 
   19 extern std::size_t test_columns_value;
 
   28 #ifdef UNIT_TEST_BUILD 
   29     return test_columns_value;
 
   31 #    if defined(__linux__) || defined(__APPLE__) 
   34     if (::ioctl(0, TIOCGWINSZ, &w) != 0) {
 
   40     CONSOLE_SCREEN_BUFFER_INFO csbi;
 
   41     if (!GetConsoleScreenBufferInfo(GetStdHandle(STD_ERROR_HANDLE), &csbi)) {
 
   44     return csbi.srWindow.Right - csbi.srWindow.Left + 1;