@@ -650,3 +650,43 @@ fn test_flow_tap_after_early_fire_does_not_jam() {
650650 ]
651651 } ;
652652}
653+
654+ /// Regression test: a tap resolved by flow-tap (e.g. right after a burst of typing) must
655+ /// still allow a hold-after-tap continuation, so press-and-hold after that tap repeats the
656+ /// tap action instead of resolving as a fresh hold.
657+ ///
658+ /// Before the fix, flow-tap fired the tap and removed the key from the held buffer on
659+ /// release, leaving no trace. A subsequent press-and-hold was therefore a brand-new press
660+ /// and resolved to the hold action (RShift here) instead of hold-after-tap (Backspace). The
661+ /// early-fire path did not have this problem because it leaves an EarlyFired breadcrumb; the
662+ /// fix makes flow-tapped taps leave the same breadcrumb when a hold-after-tap action exists.
663+ #[ test]
664+ fn test_flow_tapped_tap_then_hold_after_tap ( ) {
665+ key_sequence_test ! {
666+ keyboard: create_flow_tap_early_fire_keyboard( ) ,
667+ sequence: [
668+ // Type A, then tap td!(0) within prior_idle_time so the tap is resolved by flow-tap.
669+ [ 0 , 1 , true , 200 ] ,
670+ [ 0 , 1 , false , 30 ] ,
671+ [ 0 , 0 , true , 50 ] ,
672+ [ 0 , 0 , false , 30 ] ,
673+ // Re-press td!(0) within the gap timeout and hold past the hold timeout.
674+ // With the fix this continues into hold-after-tap (Backspace held); before it
675+ // resolved as a fresh hold (RShift).
676+ [ 0 , 0 , true , 150 ] ,
677+ [ 0 , 0 , false , 400 ] ,
678+ ] ,
679+ expected_reports: [
680+ // Type A.
681+ [ 0 , [ kc_to_u8!( A ) , 0 , 0 , 0 , 0 , 0 ] ] ,
682+ [ 0 , [ 0 , 0 , 0 , 0 , 0 , 0 ] ] ,
683+ // Flow-tapped tap: Backspace press (held) then release on key-up.
684+ [ 0 , [ kc_to_u8!( Backspace ) , 0 , 0 , 0 , 0 , 0 ] ] ,
685+ [ 0 , [ 0 , 0 , 0 , 0 , 0 , 0 ] ] ,
686+ // Re-press held: hold-after-tap fires Backspace (held), released on key-up.
687+ // RShift would mean the continuation breadcrumb was lost.
688+ [ 0 , [ kc_to_u8!( Backspace ) , 0 , 0 , 0 , 0 , 0 ] ] ,
689+ [ 0 , [ 0 , 0 , 0 , 0 , 0 , 0 ] ]
690+ ]
691+ } ;
692+ }
0 commit comments