terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Add support for DECARM (Auto Repeat Mode)

Open j4james opened this issue 3 years ago • 1 comments

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?

j4james avatar Sep 03 '22 10:09 j4james

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

zadjii-msft avatar Sep 13 '22 11:09 zadjii-msft

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

Handy links:

ghost avatar Jan 24 '23 18:01 ghost