* Flow Tap bug fix.
As reported by @amarz45 and @mwpardue, there is a bug where if two
tap-hold keys are pressed in distinct taps back to back, then Flow Tap
is not applied on the second tap-hold key, but it should be.
In a related bug reported by @NikGovorov, if a tap-hold key is held
followed by a tap of a tap-hold key, then Flow Tap updates its timer on
the release of the held tap-hold key, but it should be ignored.
The problem common to both these bugs is that I incorrectly assumed
`tapping_key` is cleared to noevent once it is released, when actually
`tapping_key` is still maintained for `TAPPING_TERM` ms after release
(for Quick Tap). This commit fixes that. Thanks to @amarz45, @mwpardue,
and @NikGovorov for reporting!
Details:
* Logic for converting the current tap-hold event to a tap is extracted
to `flow_tap_key_if_within_term()`, which is now invoked also in the
post-release "interfered with other tap key" case. This fixes the
distinct taps bug.
* The Flow Tap timer is now updated at the beginning of each call to
`process_record()`, provided that there is no unsettled tap-hold key
at that time and that the record is not for a mod or layer switch key.
By moving this update logic to `process_record()`, it is conceptually
simpler and more robust.
* Unit tests extended to cover the reported scenarios.
* Fix formatting.
* Revision to fix @NikGovorov's scenario.
The issue is that when another key is pressed while a layer-tap hasn't
been settled yet, the `prev_keycode` remembers the keycode from before
the layer switched. This can then enable Flow Tap for the following key
when it shouldn't, or vice versa.
Thanks to @NikGovorov for reporting!
This commit revises Flow Tap in the following ways:
* The previous key and timer are both updated from `process_record()`.
This is slightly later in the sequence of processing than before, and
by this point, a just-settled layer-tap should have taken effect so
that the keycode from the correct layer is remembered.
* The Flow Tap previous key and timer are updated now also on key
release events, except for releases of modifiers and held layer
switches.
* The Flow Tap previous key and timer are now updated together, for
simplicity. This makes the logic easier to think about.
* A few additional unit tests, including @NikGovorov's scenario as
"layer_tap_ignored_with_disabled_key_complex."
* Add keyevent for combo keyrecord
* Fix formatting
* Update quantum/process_keycode/process_combo.c
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
* Add combo unit-tests and hot-fix process_record_tap_hint
...as this function tries to lookup the combo keys passed in. This will
be refactored in a later pr.
---------
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
Co-authored-by: Stefan Kerkmann <karlk90@pm.me>
* Fix state updates of one-shot locked modifiers
Activating additional one-shot locked modifiers removed previously enabled locked modifiers from the state.
`get_oneshot_locked_mods` returned zero when two or more one-shot locked modifiers were enabled and then one was disabled.
* Do not delete one-shot locked modifiers on a one-shot layer toggle
Non-locked one-shot modifiers are not removed so this behavior adds inconsistency.
Also the one-shot locked modifiers state was reset without unregistering any modifiers.