Permalink
Browse files

Use buffer width and window height for screen size

  • Loading branch information...
1 parent 9f0defd commit a9e9a99507c041306953c3422d1a2ea079df7d22 @mridgers committed Dec 28, 2015
Showing with 4 additions and 3 deletions.
  1. +2 −1 clink/dll/getc.c
  2. +2 −2 readline/compat/termcap.c
View
@@ -146,7 +146,8 @@ static int getc_internal(int* alt)
GetConsoleScreenBufferInfo(handle_stdout, &csbi);
// Check for a new buffer size for simulated SIGWINCH signals.
- i = (csbi.dwSize.X << 16) | csbi.dwSize.Y;
+ i = (csbi.dwSize.X << 16);
+ i |= (csbi.srWindow.Bottom - csbi.srWindow.Top) + 1;
if (!g_knownBufferSize || g_knownBufferSize != i)
{
if (g_knownBufferSize)
@@ -19,7 +19,7 @@
* SOFTWARE.
*/
-#define TERMCAP_DEBUG 0
+#define TERMCAP_DEBUG 0
#include <Windows.h>
@@ -275,7 +275,7 @@ static void get_screen_size(int* width, int* height)
if (GetConsoleScreenBufferInfo(handle, &csbi))
{
*width = csbi.dwSize.X;
- *height = csbi.dwSize.Y;
+ *height = (csbi.srWindow.Bottom - csbi.srWindow.Top) + 1;
return;
}
}

0 comments on commit a9e9a99

Please sign in to comment.