"Repeat assigned action" timer spuriously triggers when pressing a key quickly

Thank you for the amazing software!

Describe the bug

When "Repeat assigned action while pressing" is enabled for a keyboard shortcut, if you press (and release) the shortcut repeatedly very quickly, the repeater will trigger, even if you never hold the key down for the repeat delay duration consecutively.

In other words, if you press and release a shortcut many times rapidly, you will get duplicate actions.

(If I can speculate, I might guess that this is due to the code kicking off a timer when the shortcut is pressed with duration of repeat_delay, and when that timer expires, the code checks whether the key is still down. This doesn't take into account that the key may have been released between when the timer was started and when it expired, so the timer should have been killed, but it's not. But that's just my guess.)

To reproduce, create a keyboard shortcut for Option+C, and assign the action "c" (just insert the character "c"). Check the "Repeat assigned action" box. Set the Repeat Rate to ".01" and the Repeat Delay to ".3". If you focus a text field and repeatedly press and release Option+C (without holding down for more than .3 seconds at any time) you will get a bunch more actions triggered than you press the button.


Affected input device: Keyboard.


Device information:

  • Type of Mac: 2023 Macbook Pro
  • macOS version: Sonoma
  • BetterTouchTool version: 45730

Bump. Is any more information needed here?

bump!

I'll look into this soon, I think I can reproduce it. Unfortunately it's not just a timer