diff options
author | Ron Yorston <rmy@pobox.com> | 2023-07-01 12:52:24 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-07-01 12:52:24 +0100 |
commit | 40217f5588a34d9ddf456307bcd79ce3ef8af2c0 (patch) | |
tree | 2528f11ed41e28bdf7aeecc59d765b08516046b6 /win32/winansi.c | |
parent | b2ea663bada3acc89a5aa8ffb96f053ef90d6ac7 (diff) | |
download | busybox-w32-40217f5588a34d9ddf456307bcd79ce3ef8af2c0.tar.gz busybox-w32-40217f5588a34d9ddf456307bcd79ce3ef8af2c0.tar.bz2 busybox-w32-40217f5588a34d9ddf456307bcd79ce3ef8af2c0.zip |
win32: code shrink readConsoleInput_utf8
Move decision about how to read console input from windows_read_key()
to readConsoleInput_utf8().
Saves 48-64 bytes.
Diffstat (limited to 'win32/winansi.c')
-rw-r--r-- | win32/winansi.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/win32/winansi.c b/win32/winansi.c index 4beef3eb8..83ce076c0 100644 --- a/win32/winansi.c +++ b/win32/winansi.c | |||
@@ -1293,6 +1293,10 @@ BOOL readConsoleInput_utf8(HANDLE h, INPUT_RECORD *r, DWORD len, DWORD *got) | |||
1293 | if (len != 1) | 1293 | if (len != 1) |
1294 | return FALSE; | 1294 | return FALSE; |
1295 | 1295 | ||
1296 | // if ACP is UTF8 then we read UTF8 regardless of console (in) CP | ||
1297 | if (GetConsoleCP() != CP_UTF8 && GetACP() != CP_UTF8) | ||
1298 | return ReadConsoleInput(h, r, len, got); | ||
1299 | |||
1296 | if (u8pos == u8len) { | 1300 | if (u8pos == u8len) { |
1297 | DWORD codepoint; | 1301 | DWORD codepoint; |
1298 | 1302 | ||