8166535: jshell tool: cannot handle non-ascii characters

Using a more appropriate native method to read from the console.

Reviewed-by: rfield
This commit is contained in:
Jan Lahoda
2017-01-30 13:14:09 +01:00
parent cdfdfbe315
commit 8fc452bec7

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -77,7 +77,7 @@ JNIEXPORT jobject JNICALL Java_jdk_internal_jline_WindowsTerminal_readKeyEvent
INPUT_RECORD record;
DWORD n;
while (TRUE) {
if (ReadConsoleInput(hStdIn, &record, 1, &n) == 0) {
if (ReadConsoleInputW(hStdIn, &record, 1, &n) == 0) {
return NULL;
}
if (record.EventType == KEY_EVENT) {
@@ -97,7 +97,7 @@ JNIEXPORT jobject JNICALL Java_jdk_internal_jline_WindowsTerminal_readKeyEvent
JNIEXPORT jint JNICALL Java_jdk_internal_jline_WindowsTerminal_getConsoleOutputCodepage
(JNIEnv *, jobject) {
return GetConsoleCP();
return GetConsoleOutputCP();
}
JNIEXPORT jint JNICALL Java_jdk_internal_jline_WindowsTerminal_getWindowsTerminalWidth