Implement w32 terminal size detection (fails on wine, untested on cmd.exe)

This commit is contained in:
pancake 2015-01-12 16:05:33 +01:00
parent c6ebdac011
commit 45a1eb5ca0

View File

@ -578,7 +578,12 @@ R_API int r_cons_get_cursor(int *rows) {
// XXX: if this function returns <0 in rows or cols expect MAYHEM
R_API int r_cons_get_size(int *rows) {
#if EMSCRIPTEN
#if __WINDOWS__
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &csbi);
I.columns = csbi.srWindow.Right - csbi.srWindow.Left + 1;
I.rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
#elif EMSCRIPTEN
I.columns = 80;
I.rows = 23;
#elif __UNIX__