diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/winansi.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/win32/winansi.c b/win32/winansi.c index 3276913da..7730fd006 100644 --- a/win32/winansi.c +++ b/win32/winansi.c | |||
@@ -417,3 +417,20 @@ int winansi_printf(const char *format, ...) | |||
417 | 417 | ||
418 | return rv; | 418 | return rv; |
419 | } | 419 | } |
420 | |||
421 | int winansi_get_terminal_width_height(struct winsize *win) | ||
422 | { | ||
423 | BOOL ret; | ||
424 | CONSOLE_SCREEN_BUFFER_INFO sbi; | ||
425 | |||
426 | init(); | ||
427 | |||
428 | win->ws_row = 0; | ||
429 | win->ws_col = 0; | ||
430 | if ((ret=GetConsoleScreenBufferInfo(console, &sbi)) != 0) { | ||
431 | win->ws_row = sbi.srWindow.Bottom - sbi.srWindow.Top + 1; | ||
432 | win->ws_col = sbi.srWindow.Right - sbi.srWindow.Left + 1; | ||
433 | } | ||
434 | |||
435 | return ret; | ||
436 | } | ||