diff options
author | Daniel Jacobowitz <drow@false.org> | 2006-02-23 18:14:43 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2006-02-23 18:14:43 +0000 |
commit | d4fdc52404ae433252cfe18001452951ab899157 (patch) | |
tree | 4f6f90700ef24488358ce3d2fd2b1f41619ee6db /readline/terminal.c | |
parent | 19a7219fd198b980a70cdbdc158b96cd5446e7f3 (diff) | |
download | gdb-d4fdc52404ae433252cfe18001452951ab899157.zip gdb-d4fdc52404ae433252cfe18001452951ab899157.tar.gz gdb-d4fdc52404ae433252cfe18001452951ab899157.tar.bz2 |
* readline/terminal.c (_rl_get_screen_size): Get console size from
the Windows API when compiling with MinGW.
Diffstat (limited to 'readline/terminal.c')
-rw-r--r-- | readline/terminal.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/readline/terminal.c b/readline/terminal.c index 06bc8e9..ce45d28 100644 --- a/readline/terminal.c +++ b/readline/terminal.c @@ -70,6 +70,11 @@ #include "rlshell.h" #include "xmalloc.h" +#if defined (__MINGW32__) +# include <windows.h> +# include <wincon.h> +#endif + #define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay) #define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc) @@ -209,6 +214,20 @@ _rl_get_screen_size (tty, ignore_env) } #endif /* TIOCGWINSZ */ + /* For MinGW, we get the console size from the Windows API. */ +#if defined (__MINGW32__) + HANDLE hConOut = GetStdHandle (STD_OUTPUT_HANDLE); + if (hConOut != INVALID_HANDLE_VALUE) + { + CONSOLE_SCREEN_BUFFER_INFO scr; + if (GetConsoleScreenBufferInfo (hConOut, &scr)) + { + _rl_screenwidth = scr.dwSize.X; + _rl_screenheight = scr.srWindow.Bottom - scr.srWindow.Top + 1; + } + } +#endif + #if defined (__EMX__) _emx_get_screensize (&_rl_screenwidth, &_rl_screenheight); #endif |