feat: add tap-hold-keys action with named key list options#14
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PRESSED_KEYS is a HashSet<OsCode> on macOS (and Windows with interception_driver), but a HashMap<OsCode, Instant> on Windows without interception_driver. Iterating the HashMap yields tuples, so .0 is needed there, but iterating the HashSet yields OsCode directly, making .0 a compile error on macOS. Use cfg-conditional release_key calls matching the PRESSED_KEYS type definitions, consistent with the pattern used elsewhere (e.g. sim_tests/mod.rs). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code Review:
|
Code Review:
|
| Area | Status |
|---|---|
| Core logic / correctness | ✅ No bugs found |
Style (Vec::from_iter, try_fold) |
Minor cleanup needed |
| API consistency (alias constant) | Missing — worth adding |
| Test comment cleanup | Minor |
| Test for multi-list priority | Missing |
| Docs clarity | Minor wording improvement |
The feature itself is solid and fills a real gap. The above are mostly polish items; the alias constant is the one I'd consider a functional gap since every other variant has one.
Code Review:
|
| Item | Priority |
|---|---|
tap-on-press-release + concurrent unlisted key triggers Hold |
High — likely a bug |
Test for hold-on-press > tap-on-press-release priority |
Medium |
| Missing ASCII alias constant | Medium |
| Option-counting duplication | Low (cleanup) |
Code Review:
|
Adds a new tap-hold variant `tap-hold-keys` that uses named optional list parameters instead of positional key lists. This addresses the usability concern of `tap-hold-release-tap-keys-release` having too many positional parameters, and adds the ability to trigger hold early on press for specific keys (closes jtroo#1985). Syntax: (tap-hold-keys <repress-timeout> <hold-timeout> <tap> <hold> (tap-on-press <keys...>) (tap-on-press-release <keys...>) (hold-on-press <keys...>)) All list options are optional. Unlisted keys use PermissiveHold behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
631c6e5 to
1099174
Compare
Code Review:
|
- Remove .github/workflows/claude-code-review.yml - Reject duplicate keys across tap-hold-keys option lists - Update priority_order test to verify duplicate key error Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts: # src/tests/sim_tests/tap_hold_tests.rs
Summary
tap-hold-keysaction with named optional list parameters:(tap-on-press ...),(tap-on-press-release ...),(hold-on-press ...)Changes
parser/src/cfg/list_actions.rs— newTAP_HOLD_KEYSconstantparser/src/cfg/mod.rs— dispatch to new parserparser/src/cfg/tap_hold.rs— parser for named list optionsparser/src/cfg/custom_tap_hold.rs— closure with tap/hold-on-press logicsrc/tests/sim_tests/tap_hold_tests.rs— 6 new sim testsdocs/config.adoc+cfg_samples/kanata.kbd— docs and exampleTest plan
cargo test --features=simulated_output)cargo checkclean🤖 Generated with Claude Code