aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/termios.c8
-rw-r--r--win32/winansi.c10
2 files changed, 12 insertions, 6 deletions
diff --git a/win32/termios.c b/win32/termios.c
index 23184e901..7d6adaafe 100644
--- a/win32/termios.c
+++ b/win32/termios.c
@@ -34,7 +34,7 @@ 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_EURO_INPUT 37#if !ENABLE_FEATURE_UTF8_INPUT
38 wchar_t uchar; 38 wchar_t uchar;
39 char achar; 39 char achar;
40#endif 40#endif
@@ -54,7 +54,7 @@ int64_t FAST_FUNC windows_read_key(int fd, char *buf UNUSED_PARAM, int timeout)
54 if (WaitForSingleObject(cin, timeout) != WAIT_OBJECT_0) 54 if (WaitForSingleObject(cin, timeout) != WAIT_OBJECT_0)
55 goto done; 55 goto done;
56 } 56 }
57#if ENABLE_FEATURE_EURO_INPUT 57#if !ENABLE_FEATURE_UTF8_INPUT
58 if (!ReadConsoleInputW(cin, &record, 1, &nevent_out)) 58 if (!ReadConsoleInputW(cin, &record, 1, &nevent_out))
59#else 59#else
60 if (!readConsoleInput_utf8(cin, &record, 1, &nevent_out)) 60 if (!readConsoleInput_utf8(cin, &record, 1, &nevent_out))
@@ -73,7 +73,7 @@ int64_t FAST_FUNC windows_read_key(int fd, char *buf UNUSED_PARAM, int timeout)
73 } 73 }
74 alt_pressed = state & LEFT_ALT_PRESSED; 74 alt_pressed = state & LEFT_ALT_PRESSED;
75 75
76#if ENABLE_FEATURE_EURO_INPUT 76#if !ENABLE_FEATURE_UTF8_INPUT
77 if (!record.Event.KeyEvent.uChar.UnicodeChar) { 77 if (!record.Event.KeyEvent.uChar.UnicodeChar) {
78#else 78#else
79 if (!record.Event.KeyEvent.uChar.AsciiChar) { 79 if (!record.Event.KeyEvent.uChar.AsciiChar) {
@@ -119,7 +119,7 @@ int64_t FAST_FUNC windows_read_key(int fd, char *buf UNUSED_PARAM, int timeout)
119 ret &= ~0x80; 119 ret &= ~0x80;
120 goto done; 120 goto done;
121 } 121 }
122#if ENABLE_FEATURE_EURO_INPUT 122#if !ENABLE_FEATURE_UTF8_INPUT
123 uchar = record.Event.KeyEvent.uChar.UnicodeChar; 123 uchar = record.Event.KeyEvent.uChar.UnicodeChar;
124 achar = uchar & 0x7f; 124 achar = uchar & 0x7f;
125 if (achar != uchar) 125 if (achar != uchar)
diff --git a/win32/winansi.c b/win32/winansi.c
index 83ce076c0..479e5ca40 100644
--- a/win32/winansi.c
+++ b/win32/winansi.c
@@ -749,8 +749,12 @@ BOOL conToCharBuffA(LPSTR s, DWORD len)
749 CPINFO acp_info, con_info; 749 CPINFO acp_info, con_info;
750 WCHAR *buf; 750 WCHAR *buf;
751 751
752 // if acp is UTF8 then we got UTF8 via readConsoleInput_utf8 752 if (acp == conicp
753 if (acp == conicp || acp == CP_UTF8) 753#if ENABLE_FEATURE_UTF8_INPUT
754 // if acp is UTF8 then we got UTF8 via readConsoleInput_utf8
755 || acp == CP_UTF8
756#endif
757 )
754 return TRUE; 758 return TRUE;
755 759
756 if (!s || !GetCPInfo(acp, &acp_info) || !GetCPInfo(conicp, &con_info) || 760 if (!s || !GetCPInfo(acp, &acp_info) || !GetCPInfo(conicp, &con_info) ||
@@ -1173,6 +1177,7 @@ int mingw_isatty(int fd)
1173 return result; 1177 return result;
1174} 1178}
1175 1179
1180#if ENABLE_FEATURE_UTF8_INPUT
1176// intentionally also converts invalid values (surrogate halfs, too big) 1181// intentionally also converts invalid values (surrogate halfs, too big)
1177static int toutf8(DWORD cp, unsigned char *buf) { 1182static int toutf8(DWORD cp, unsigned char *buf) {
1178 if (cp <= 0x7f) { 1183 if (cp <= 0x7f) {
@@ -1343,3 +1348,4 @@ BOOL readConsoleInput_utf8(HANDLE h, INPUT_RECORD *r, DWORD len, DWORD *got)
1343 *got = 1; 1348 *got = 1;
1344 return TRUE; 1349 return TRUE;
1345} 1350}
1351#endif