PyREPL does not handle wRepeatCount
on Windows, causing incorrect 'dead key' behavior
#127947
Labels
OS-windows
topic-repl
Related to the interactive shell
type-bug
An unexpected behavior, bug, or error
Bug report
Bug description:
PyREPL (introduced in Python 3.13) fails to account for the
wRepeatCount
field in the KEY_EVENT_RECORD on Windows, resulting in incorrect behavior when keys are pressed repeatedly in the REPL. This issue is reproducible in the Windows Terminal on Windows 10 or 11, specifically when using a keyboard layout with dead keys (e.g., US International layout).This issue can be bothering as it messes with muscle memory when typing quotes in the new PyREPL (which otherwise is AWESOME!)
Steps to Reproduce:
'
,"
,^
,`
, or~
) into the REPL input.Root Cause:
The Windows Terminal sends a single key event with
wRepeatCount == 2
when a key is pressed repeatedly. PyREPL does not check the wRepeatCount value, so the REPL only processes the key press once. In contrast, conhost.exe-based terminals send two separate key events for the repeated key press, causing the REPL to handle the input correctly in those environments.Desired Fix:
Modify PyREPL to correctly handle the
wRepeatCount
value in theKEY_EVENT_RECORD
. WhenwRepeatCount > 1
, the corresponding key should be processed the specified number of times to ensure correct handling of repeated key presses.CPython versions tested on:
3.13, 3.14, CPython main branch
Operating systems tested on:
Windows
Linked PRs
The text was updated successfully, but these errors were encountered: