# HG changeset patch # User jlahoda # Date 1484556814 -3600 # Node ID b232ec246f2b07829f3b0f21bff30d0f9c3c2f88 # Parent 4a7670d316ee532a94d452d37faa5e945767b1a9 8171386: jshell tool: paging of javadoc output broken on Windows Summary: Fixing detection of console window size. Reviewed-by: rfield diff -r 4a7670d316ee -r b232ec246f2b jdk/src/jdk.internal.le/windows/native/lible/WindowsTerminal.cpp --- 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; }