[PATCH v7 1/7] Cygwin: console: Fix master thread
Takashi Yano
takashi.yano@nifty.ne.jp
Wed Mar 25 13:04:07 GMT 2026
In Windows 11, key event with wRepeatCount == 0 is fixed-up to
wRepeatCount == 1 in conhost.exe. Due to this behaviour, inreq_eq()
returns false even though the two event records are the same. This
patch adds workaround for this behaviour in inrec_eq().
Addresses: https://github.com/git-for-windows/git/issues/5632
Fixes: ff4440fcf768 ("Cygwin: console: Introduce new thread which handles input signal.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Reviewed-by:
---
winsup/cygwin/fhandler/console.cc | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc
index 9fd3ff506..2f59f8f24 100644
--- a/winsup/cygwin/fhandler/console.cc
+++ b/winsup/cygwin/fhandler/console.cc
@@ -318,9 +318,16 @@ inrec_eq (const INPUT_RECORD *a, const INPUT_RECORD *b, DWORD n)
written event. Therefore they are ignored. */
const KEY_EVENT_RECORD *ak = &a[i].Event.KeyEvent;
const KEY_EVENT_RECORD *bk = &b[i].Event.KeyEvent;
+ /* Fixup repeat count */
+ WORD r1 = ak->wRepeatCount;
+ WORD r2 = bk->wRepeatCount;
+ if (r1 == 0)
+ r1 = 1;
+ if (r2 == 0)
+ r2 = 1;
if (ak->bKeyDown != bk->bKeyDown
|| ak->uChar.UnicodeChar != bk->uChar.UnicodeChar
- || ak->wRepeatCount != bk->wRepeatCount)
+ || r1 != r2)
return false;
}
else if (a[i].EventType == MOUSE_EVENT)
--
2.51.0
More information about the Cygwin-patches
mailing list