gh-127947: Repeat PyREPL key events on Windows when wRepeatCount > 1#127948
gh-127947: Repeat PyREPL key events on Windows when wRepeatCount > 1#127948SimonvBez wants to merge 11 commits into
Conversation
Keys that are repeated into PyREPL were typed only once. This change makes those characters be typed the correct number of times.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
ZeroIntensity
left a comment
There was a problem hiding this comment.
It's good to see new contributors :)
Could you add a test? See the devguide for how to write tests.
By simulating INPUT_RECORD being received
|
There was no test coverage for the |
|
I'll review this soon-ish. Could you deal with the merge conflicts in the meantime? |
|
I see #128389 has caused a merge conflict. The changes there are minimal, but it isn't marked as getting backported to 3.13. |
|
Nah, backporting is pretty easy even if the automation fails. Just deal with the conflicts on main and you're good. |
|
The one thing I'm not sure about is the current distinction between EDIT: I have been playing with it for a while, and there seems to be no change in behavior when allowing the |
And replaced deque.insert(0, o) with deque.appendleft(o) for O(1) insertion
|
I have no clue as to why one of the automated Ubuntu tests is failing of all things, considering there have only been pyrepl Windows-only changes. |
|
Hypothesis is known to be flaky right now. I've restarted the job for you, let me know if it continues to fail and I'll just rerun it until it works. |
|
This PR is stale because it has been open for 30 days with no activity. |
|
|
||
| if event is not None: | ||
| # Queue this key event to be repeated if wRepeatCount > 1, such as when a 'dead key' is pressed twice | ||
| for _ in range(rec.Event.KeyEvent.wRepeatCount - 1): |
There was a problem hiding this comment.
This only repeats the returned Esc event for ALT_ACTIVE keys. Alt+a with wRepeatCount == 2 becomes Esc, a, Esc, so we lose the second a. Can we repeat the full translated sequence here?
|
|
||
| if event is not None: | ||
| # Queue this key event to be repeated if wRepeatCount > 1, such as when a 'dead key' is pressed twice | ||
| for _ in range(rec.Event.KeyEvent.wRepeatCount - 1): |
There was a problem hiding this comment.
What happens when a key with ALT_ACTIVE repeats (wRepeatCount > 1)? _event_from_keyevent already queues the real key and returns the meta \033, so this loop only duplicates the meta event and we lose the repeated key, leaving a dangling meta. We probably want to repeat the whole meta+key sequence here, no?
Keys that are repeated into PyREPL were typed only once on Windows.
This has been consistently happening when typing a dead key repeatedly, such as when double-pressing the quote character on the US International keyboard layout.
This change makes those characters be typed the correct number of times.
wRepeatCounton Windows, causing incorrect 'dead key' behavior #127947