fix tapdance reporting key in wrong order
This commit is contained in:
parent
e829bc83de
commit
bb2ddc1e33
@ -44,7 +44,19 @@ class TapDance(HoldTap):
|
||||
if isinstance(key.meta, TapDanceKeyMeta):
|
||||
if key in self.td_counts:
|
||||
return key
|
||||
return super().process_key(keyboard, key, is_pressed, int_coord)
|
||||
|
||||
for _key, state in self.key_states.copy().items():
|
||||
if state.activated == ActivationType.RELEASED:
|
||||
keyboard.cancel_timeout(state.timeout_key)
|
||||
self.ht_activate_tap(_key, keyboard)
|
||||
keyboard._send_hid()
|
||||
self.ht_deactivate_tap(_key, keyboard)
|
||||
del self.key_states[_key]
|
||||
del self.td_counts[state.tap_dance]
|
||||
|
||||
key = super().process_key(keyboard, key, is_pressed, int_coord)
|
||||
|
||||
return key
|
||||
|
||||
def td_pressed(self, key, keyboard, *args, **kwargs):
|
||||
# active tap dance
|
||||
@ -61,6 +73,8 @@ class TapDance(HoldTap):
|
||||
self.key_states[kc].activated = ActivationType.RELEASED
|
||||
self.on_tap_time_expired(kc, keyboard)
|
||||
count = 0
|
||||
else:
|
||||
del self.key_states[kc]
|
||||
|
||||
# new tap dance
|
||||
else:
|
||||
|
@ -68,6 +68,12 @@ class TestTapDance(unittest.TestCase):
|
||||
[{KC.N0}, {KC.N0, KC.N4}, {KC.N4}, {}],
|
||||
)
|
||||
|
||||
keyboard.test(
|
||||
'Tap x1 interrupted',
|
||||
[(0, True), (0, False), (4, True), (4, False)],
|
||||
[{KC.N0}, {KC.N4}, {}],
|
||||
)
|
||||
|
||||
keyboard.test(
|
||||
'Tap x2, interrupted',
|
||||
[
|
||||
|
Loading…
Reference in New Issue
Block a user