diff options
Diffstat (limited to 'win32/termios.c')
-rw-r--r-- | win32/termios.c | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/win32/termios.c b/win32/termios.c index 7d6adaafe..f18ff7c3b 100644 --- a/win32/termios.c +++ b/win32/termios.c | |||
@@ -34,10 +34,6 @@ int64_t FAST_FUNC windows_read_key(int fd, char *buf UNUSED_PARAM, int timeout) | |||
34 | INPUT_RECORD record; | 34 | INPUT_RECORD record; |
35 | DWORD nevent_out, mode; | 35 | DWORD nevent_out, mode; |
36 | int ret = -1; | 36 | int ret = -1; |
37 | #if !ENABLE_FEATURE_UTF8_INPUT | ||
38 | wchar_t uchar; | ||
39 | char achar; | ||
40 | #endif | ||
41 | DWORD alt_pressed = FALSE; | 37 | DWORD alt_pressed = FALSE; |
42 | DWORD state; | 38 | DWORD state; |
43 | 39 | ||
@@ -54,11 +50,7 @@ int64_t FAST_FUNC windows_read_key(int fd, char *buf UNUSED_PARAM, int timeout) | |||
54 | if (WaitForSingleObject(cin, timeout) != WAIT_OBJECT_0) | 50 | if (WaitForSingleObject(cin, timeout) != WAIT_OBJECT_0) |
55 | goto done; | 51 | goto done; |
56 | } | 52 | } |
57 | #if !ENABLE_FEATURE_UTF8_INPUT | ||
58 | if (!ReadConsoleInputW(cin, &record, 1, &nevent_out)) | ||
59 | #else | ||
60 | if (!readConsoleInput_utf8(cin, &record, 1, &nevent_out)) | 53 | if (!readConsoleInput_utf8(cin, &record, 1, &nevent_out)) |
61 | #endif | ||
62 | goto done; | 54 | goto done; |
63 | 55 | ||
64 | if (record.EventType != KEY_EVENT) | 56 | if (record.EventType != KEY_EVENT) |
@@ -73,11 +65,7 @@ int64_t FAST_FUNC windows_read_key(int fd, char *buf UNUSED_PARAM, int timeout) | |||
73 | } | 65 | } |
74 | alt_pressed = state & LEFT_ALT_PRESSED; | 66 | alt_pressed = state & LEFT_ALT_PRESSED; |
75 | 67 | ||
76 | #if !ENABLE_FEATURE_UTF8_INPUT | ||
77 | if (!record.Event.KeyEvent.uChar.UnicodeChar) { | ||
78 | #else | ||
79 | if (!record.Event.KeyEvent.uChar.AsciiChar) { | 68 | if (!record.Event.KeyEvent.uChar.AsciiChar) { |
80 | #endif | ||
81 | if (alt_pressed && !(state & ENHANCED_KEY)) { | 69 | if (alt_pressed && !(state & ENHANCED_KEY)) { |
82 | /* keys on numeric pad used to enter character codes */ | 70 | /* keys on numeric pad used to enter character codes */ |
83 | switch (record.Event.KeyEvent.wVirtualKeyCode) { | 71 | switch (record.Event.KeyEvent.wVirtualKeyCode) { |
@@ -119,19 +107,11 @@ int64_t FAST_FUNC windows_read_key(int fd, char *buf UNUSED_PARAM, int timeout) | |||
119 | ret &= ~0x80; | 107 | ret &= ~0x80; |
120 | goto done; | 108 | goto done; |
121 | } | 109 | } |
122 | #if !ENABLE_FEATURE_UTF8_INPUT | ||
123 | uchar = record.Event.KeyEvent.uChar.UnicodeChar; | ||
124 | achar = uchar & 0x7f; | ||
125 | if (achar != uchar) | ||
126 | WideCharToMultiByte(CP_ACP, 0, &uchar, 1, &achar, 1, NULL, NULL); | ||
127 | ret = achar; | ||
128 | #else | ||
129 | if ( (record.Event.KeyEvent.uChar.AsciiChar & 0x80) == 0x80 ) { | 110 | if ( (record.Event.KeyEvent.uChar.AsciiChar & 0x80) == 0x80 ) { |
130 | char *s = &record.Event.KeyEvent.uChar.AsciiChar; | 111 | char *s = &record.Event.KeyEvent.uChar.AsciiChar; |
131 | conToCharBuffA(s, 1); | 112 | conToCharBuffA(s, 1); |
132 | } | 113 | } |
133 | ret = record.Event.KeyEvent.uChar.AsciiChar; | 114 | ret = record.Event.KeyEvent.uChar.AsciiChar; |
134 | #endif | ||
135 | if (state & (RIGHT_ALT_PRESSED|LEFT_ALT_PRESSED)) { | 115 | if (state & (RIGHT_ALT_PRESSED|LEFT_ALT_PRESSED)) { |
136 | switch (ret) { | 116 | switch (ret) { |
137 | case '\b': ret = KEYCODE_ALT_BACKSPACE; goto done; | 117 | case '\b': ret = KEYCODE_ALT_BACKSPACE; goto done; |