Add support for DECARM (Auto Repeat Mode) #18375

Open
opened 2026-01-31 06:12:01 +00:00 by claunia · 0 comments
Owner

Originally created by @j4james on GitHub (Sep 3, 2022).

Description of the new feature/enhancement

Auto Repeat Mode controls whether a keypress automatically repeats if you keep it held down for long enough. Technically it's a level 1 conformance requirement, and has been supported on every DEC terminal from the VT100 onwards.

My personal use case was for a game I was working on, where holding down a key for too long could end up generating spurious keypresses, and the hero would accidentally throw themselves off the edge of a cliff. Being able to disable the auto repeat makes that less of an issue.

Proposed technical implementation details (optional)

Every time we receive a keydown event, we record the virtual key code to track that as the last key pressed. If we receive a keyup event the matches that last key code, we reset that field. Then if the auto repeat mode is reset, and we receive a keydown event that matches the last key code, we simply ignore it.

This approach works great in conhost, but not so well in Windows Terminal (because of issue #8440). It does work for the arrow keys, though, which is my primary use case. So the question is, would you be happy to accept a PR for this, even if it doesn't fully work in Windows Terminal? Or do we need to fix #8440 first?

Originally created by @j4james on GitHub (Sep 3, 2022). # Description of the new feature/enhancement _Auto Repeat Mode_ controls whether a keypress automatically repeats if you keep it held down for long enough. Technically it's a level 1 conformance requirement, and has been supported on every DEC terminal from the VT100 onwards. My personal use case was for a game I was working on, where holding down a key for too long could end up generating spurious keypresses, and the hero would accidentally throw themselves off the edge of a cliff. Being able to disable the auto repeat makes that less of an issue. # Proposed technical implementation details (optional) Every time we receive a keydown event, we record the virtual key code to track that as the last key pressed. If we receive a keyup event the matches that last key code, we reset that field. Then if the auto repeat mode is *reset*, and we receive a keydown event that matches the last key code, we simply ignore it. This approach works great in conhost, but not so well in Windows Terminal (because of issue #8440). It does work for the arrow keys, though, which is my primary use case. So the question is, would you be happy to accept a PR for this, even if it doesn't fully work in Windows Terminal? Or do we need to fix #8440 first?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18375