Add support for DECARM (Auto Repeat Mode) #18377

Closed
opened 2026-01-31 06:12:05 +00:00 by claunia · 2 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?
Author
Owner

@zadjii-msft commented on GitHub (Sep 13, 2022):

Meh, I won't let perfect be the enemy of the good.

@zadjii-msft commented on GitHub (Sep 13, 2022): Meh, I won't let perfect be the enemy of the good.
Author
Owner

@ghost commented on GitHub (Jan 24, 2023):

:tada:This issue was addressed in #13981, which has now been successfully released as Windows Terminal Preview v1.17.1023.🎉

Handy links:

@ghost commented on GitHub (Jan 24, 2023): :tada:This issue was addressed in #13981, which has now been successfully released as `Windows Terminal Preview v1.17.1023`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.17.1023) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18377