feat: add tap-hold-opposite-hand-release action#15
Conversation
A release-time variant of tap-hold-opposite-hand. Same signature, options, and defhands dependency. The only difference is that it waits for the interrupting key's press+release before committing, which avoids misfires on fast same-hand rolls where keystrokes briefly overlap. This closes the main gap between kanata HRM behavior and ZMK's "timeless home-row mods" recipe. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code ReviewOverall this is a well-structured addition that fills a real gap for ZMK-style timeless home-row mods. The implementation is correct and the tests demonstrate the key behavioral difference from Bugs / CorrectnessStale development comment left in test (
// Note: 's' is same-hand but not in defsrc, use a key in defsrc.
// Actually, 'a' is the tap-hold key itself. Let me use a different config.These look like in-editor scratch notes. They should be removed — a test comment should describe intent, not thinking-out-loud during authorship. Code Quality / Duplication
A shared helper accepting a function-pointer/flag would eliminate the duplication: fn parse_tap_hold_opposite_hand_inner(
ac_params: &[SExpr],
s: &ParserState,
wait_for_release: bool,
) -> Result<&'static KanataAction> { ... }Similarly, Performance (hot path)O(n²) release scan ( if !queued.clone().copied().any(|q| q.event() == release) {
continue;
}For each press event in the queue, we clone and scan the remainder of the queue for a matching release — O(n) per press, O(n²) total. The existing Unrelated changes mixed inThe PR includes three changes that appear unrelated to
None of these are blockers, but mixing unrelated fixes makes Minor
Test coverageThe 5 simulation tests cover the main cases well. Missing coverage:
These aren't blocking, but they'd round out the test suite and prevent regressions if the option parsing is ever refactored. |
- Remove stale dev comment from test - Add tests for (same-hand hold), (same-hand ignore), and (neutral-keys) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code Review:
|
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code Review:
|
Summary
A release-time variant of
tap-hold-opposite-hand. Same signature, options, anddefhandsdependency. The only difference is that it waits for the interrupting key's press+release before committing, which avoids misfires on fast same-hand rolls where keystrokes briefly overlap.This closes the main gap between kanata HRM behavior and ZMK's "timeless home-row mods" recipe.
Checklist
🤖 Generated with Claude Code