changeset 43107:b232ec246f2b

8171386: jshell tool: paging of javadoc output broken on Windows Summary: Fixing detection of console window size. Reviewed-by: rfield
author jlahoda
date Mon, 16 Jan 2017 09:53:34 +0100
parents 4a7670d316ee
children 9849ccac1f10
files jdk/src/jdk.internal.le/windows/native/lible/WindowsTerminal.cpp
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/jdk.internal.le/windows/native/lible/WindowsTerminal.cpp	Mon Jan 16 15:16:10 2017 +0800
+++ b/jdk/src/jdk.internal.le/windows/native/lible/WindowsTerminal.cpp	Mon Jan 16 09:53:34 2017 +0100
@@ -102,26 +102,26 @@
 
 JNIEXPORT jint JNICALL Java_jdk_internal_jline_WindowsTerminal_getWindowsTerminalWidth
   (JNIEnv *, jobject) {
-    HANDLE hStdIn;
-    if ((hStdIn = GetStdHandle(STD_INPUT_HANDLE)) == INVALID_HANDLE_VALUE) {
+    HANDLE hStdOut;
+    if ((hStdOut = GetStdHandle(STD_OUTPUT_HANDLE)) == INVALID_HANDLE_VALUE) {
         return -1;
     }
     CONSOLE_SCREEN_BUFFER_INFO info;
-    if (! GetConsoleScreenBufferInfo(hStdIn, &info)) {
+    if (! GetConsoleScreenBufferInfo(hStdOut, &info)) {
         return -1;
     }
-    return info.dwSize.X;
+    return info.srWindow.Right - info.srWindow.Left;
 }
 
 JNIEXPORT jint JNICALL Java_jdk_internal_jline_WindowsTerminal_getWindowsTerminalHeight
   (JNIEnv *, jobject) {
-    HANDLE hStdIn;
-    if ((hStdIn = GetStdHandle(STD_INPUT_HANDLE)) == INVALID_HANDLE_VALUE) {
+    HANDLE hStdOut;
+    if ((hStdOut = GetStdHandle(STD_OUTPUT_HANDLE)) == INVALID_HANDLE_VALUE) {
         return -1;
     }
     CONSOLE_SCREEN_BUFFER_INFO info;
-    if (! GetConsoleScreenBufferInfo(hStdIn, &info)) {
+    if (! GetConsoleScreenBufferInfo(hStdOut, &info)) {
         return -1;
     }
-    return info.dwSize.Y;
+    return info.srWindow.Bottom - info.srWindow.Top + 1;
 }