Skip to content

fix(keybind): handle sticky leader modifiers#12573

Open
d-init-d wants to merge 1 commit intoanomalyco:devfrom
d-init-d:fix/leader-keybind-miss-second-key
Open

fix(keybind): handle sticky leader modifiers#12573
d-init-d wants to merge 1 commit intoanomalyco:devfrom
d-init-d:fix/leader-keybind-miss-second-key

Conversation

@d-init-d
Copy link

@d-init-d d-init-d commented Feb 7, 2026

What

  • Improve keybind decoding for terminals that send Ctrl+letter as ASCII control codes.
  • Make leader-chord matching resilient when users keep holding the leader modifier ("sticky" Ctrl/Meta/etc).

Why

Some terminals emit Ctrl combinations as control bytes (e.g. \x07), and users often keep Ctrl held after pressing a leader chord (e.g. ctrl+x then g). This combination can cause the second key to be missed even though the chord intent is clear.

How

  • Normalize ASCII control codes in Keybind.fromParsedKey() (1..26 => ctrl+a..z, 0x1F => ctrl+_), while intentionally skipping ambiguous codes (tab/enter/backspace/etc).
  • When a leader is active, attempt exact match first; if that fails, retry after stripping the captured leader modifiers from the incoming key event.

Tests

  • cd packages/opencode && bun test test/keybind.test.ts
  • cd packages/opencode && bun run typecheck

Fixes #10444

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

session_child_cycle + session_child_cycle_reverse stopped working

1 participant