X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fio%2Fconsole.cpp;h=a03ad20747bf251c40c57f682e027f760756cb7e;hp=6ae969914b732319ed78609a30d294e3b670c609;hb=bdea0d5d312658f8ca4a52b2c645ed7c6d78c983;hpb=2dd1d157ddccb7a48351d58db05982428b7b3a6d diff --git a/source/io/console.cpp b/source/io/console.cpp index 6ae9699..a03ad20 100644 --- a/source/io/console.cpp +++ b/source/io/console.cpp @@ -124,9 +124,12 @@ void Console::get_size(unsigned &rows, unsigned &cols) check_access(M_WRITE); #ifdef WIN32 - // XXX Figure out how to do this - rows = 24; - cols = 80; + CONSOLE_SCREEN_BUFFER_INFO sbi; + if(!GetConsoleScreenBufferInfo(*handle, &sbi)) + throw system_error("GetConsoleScreenBufferInfo"); + // Right/bottom coords are inclusive + rows = sbi.srWindow.Bottom+1-sbi.srWindow.Top; + cols = sbi.srWindow.Right+1-sbi.srWindow.Left; #else struct winsize wsz; if(ioctl(*handle, TIOCGWINSZ, &wsz)==-1)