From 00db3770b031c580feba47610169f077ac81dc4a Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Sun, 3 Sep 2023 01:13:50 +0300 Subject: win32: UTF8_INPUT: fix combining of some surrogates pairs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The construction of a codepoint from a surrogates pair was incorrect when the result should have had the 0x10000 bit unset, due to logical "|" instead of arithmetic "+" of 0x10000 (so the 0x10000 bit was set incorrectly when the result should have been U+[1]{0,2,4...C,E}XXXX). For instance: typing or pasting U+20000 𠀀 --- win32/winansi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32/winansi.c b/win32/winansi.c index 591154378..b5111603c 100644 --- a/win32/winansi.c +++ b/win32/winansi.c @@ -1276,7 +1276,7 @@ static void maybeEatUpto2ndHalfUp(HANDLE h, DWORD *ph1) // got 2nd-half-up. eat the events up to this, combine the values ReadConsoleInputW(h, r, i, &got); - *ph1 = 0x10000 | ((*ph1 & ~0xD800) << 10) | (h2 & ~0xDC00); + *ph1 = 0x10000 + (((*ph1 & ~0xD800) << 10) | (h2 & ~0xDC00)); return; } } -- cgit v1.2.3-55-g6feb