mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-24 07:45:21 +00:00
Apparently, ReadConsoleInputA() does mistaken sign extension to 16 bits,
rather than writing only the bottom 8 bits of the decoded key to the event structure. PDCurses, in turn, was reading the whole 16 bits even in narrow mode, resulting in corrupted "high-bit" characters in wincon. Potentially an issue since 3.0 (assuming ReadConsoleInputA() always did this?), but seemingly unreported (?) until now. Reported by Simon Sobisch.
This commit is contained in:
@@ -331,7 +331,12 @@ static int _get_key_count(void)
|
||||
|
||||
static int _process_key_event(void)
|
||||
{
|
||||
int key = (unsigned short)KEV.uChar.UnicodeChar;
|
||||
int key =
|
||||
#ifdef PDC_WIDE
|
||||
KEV.uChar.UnicodeChar;
|
||||
#else
|
||||
KEV.uChar.AsciiChar;
|
||||
#endif
|
||||
WORD vk = KEV.wVirtualKeyCode;
|
||||
DWORD state = KEV.dwControlKeyState;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user