33
44#ifdef _WIN32 // windows
55
6- #include < wchar.h>
76#include < windows.h>
87
98#else // not windows
2019#include < cassert>
2120#include < cstdint>
2221#include < iostream>
23- #include < ostream>
2422#include < sstream>
2523#include < string>
2624#include < utility> // for std::pair
@@ -60,7 +58,7 @@ namespace tui {
6058 exit (1 ); \
6159 } \
6260 DWORD mode; \
63- if (! GetConsoleMode(hStdin, &mode)) { \
61+ if (GetConsoleMode(hStdin, &mode) == 0 ) { \
6462 std::cerr << " error getting the console mode\n " ; \
6563 exit (1 ); \
6664 }
@@ -73,7 +71,7 @@ namespace tui {
7371 DWORD newMode = mode;
7472 newMode &= ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
7573
76- if (! SetConsoleMode (hStdin, newMode)) {
74+ if (SetConsoleMode (hStdin, newMode) == 0 ) {
7775 std::cerr << " error setting the console to raw mode\n " ;
7876 exit (1 );
7977 }
@@ -102,7 +100,7 @@ namespace tui {
102100
103101 // Restore original mode
104102 mode |= (ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
105- if (! SetConsoleMode (hStdin, mode)) {
103+ if (SetConsoleMode (hStdin, mode) == 0 ) {
106104 std::cerr << " error restoring the console mode\n " ;
107105 exit (1 );
108106 }
@@ -237,9 +235,8 @@ namespace tui {
237235 inline std::pair<unsigned , unsigned > size () {
238236#ifdef _WIN32
239237 auto info = get_console_buf_info ();
240- short rows, columns;
241- columns = info.srWindow .Right - info.srWindow .Left + 1 ;
242- rows = info.srWindow .Bottom - info.srWindow .Top + 1 ;
238+ int columns = info.srWindow .Right - info.srWindow .Left + 1 ;
239+ int rows = info.srWindow .Bottom - info.srWindow .Top + 1 ;
243240
244241 return {rows, columns};
245242#else
0 commit comments