fix(osm): keep OSM/OSL timeout alive across non-consuming events#866
fix(osm): keep OSM/OSL timeout alive across non-consuming events#866yekingyan wants to merge 3 commits into
Conversation
The OSM/OSL release path used a single select(timeout, next_event), so the first event arriving during the timeout cancelled the wait permanently, leaving the one-shot stuck in Single (never auto-released). A typical trigger is the release event of a layer key. Replace the single select with a deadline loop: non-consuming events are pushed to the queue and we keep waiting for the remaining time, while a consuming event (OSM: press in quick_release mode, release otherwise; OSL: press) breaks out.
Size Report
|
7c1d906 to
c74a484
Compare
| // separate OSM + morse/tap-hold timing issue, unrelated to the timeout | ||
| // fix in this change. |
There was a problem hiding this comment.
I feel like "temporally bounded" LLM comments like this should be removed. It's referring to "this change" but - 50 commits and code changes later - I'm not going to know what that change is without having to dig it up.
Problem
The OSM/OSL release path waited with a single
select(timeout, next_event).The first event arriving during the timeout cancelled the wait permanently,
so the one-shot got stuck in
Singleand never auto-released. A typicaltrigger is the release event of a layer key (a non-consuming event).
(Note: the #854 TODO actually refers to a separate OSM + morse/tap-hold
timing issue, not this one — see the Test section.)
Fix
Replace the single
selectwith a deadline loop: non-consuming events arepushed to the queue and we keep waiting for the remaining time, while a
consuming event breaks out (OSM: press in quick_release mode, release
otherwise; OSL: press).
(Same fragility ldsands hit independently in the StickyMod release handler in #859.)
Test
Added
test_osm_timeout_not_cancelled_by_non_consuming_event: an OSL pressinterrupts the OSM timeout; after the timeout elapses the OSM must have
auto-released, so the later layer-1 key is sent without the modifier.
Red before the fix, green after.
The previously-omitted
test_osm_quick_release_rollingis intentionally leftout: it fails due to an unrelated OSM + morse/tap-hold timing issue (the
modifier is cleared before the buffered tap resolves), which this PR does
not address.