Skip to content

feat(keybindings): add resolved action-based keymap#166

Merged
srothgan merged 4 commits into
mainfrom
feat/keybindings-keymap
May 21, 2026
Merged

feat(keybindings): add resolved action-based keymap#166
srothgan merged 4 commits into
mainfrom
feat/keybindings-keymap

Conversation

@srothgan
Copy link
Copy Markdown
Owner

Summary

add a resolved action-based keymap layer for chat input, autocomplete, and inline prompts, then route the existing interaction handlers through that shared action model.

Keymap architecture

  • add src/app/keymap with typed key specs, key contexts, action descriptors, default binding groups, platform validation, and conflict detection
  • initialize a resolved default keymap on app startup and use it as the dispatch source for chat, autocomplete, permission, and question contexts
  • expose resolved bindings to help rendering so shortcut hints come from the active keymap instead of hardcoded UI text

Interaction handling

  • replace raw permission and question key adapters with action executors for inline prompts
  • keep permission and plan approval prompts focused on option navigation plus confirm/cancel actions rather than legacy quick-approval shortcuts
  • update inline question handling for option movement, multi-select toggles, notes editing, and response annotations through the shared interaction action path

Tool rendering

  • let .claude/plans/* markdown plan bodies render at their full wrapped height instead of inheriting the generic tool body cap
  • keep normal tool output and non-plan write diffs bounded so large tool results still stay compact
  • add regression coverage for long plan markdown rendering and ordinary write-diff capping

Why

Key handling had accumulated separate hardcoded paths across chat input, autocomplete, permissions, plan approvals, and questions. That made shortcut behavior harder to reason about, duplicated help text, and left stale raw-key adapters in place after the inline prompt work moved toward action-based dispatch.

This branch puts key behavior behind a typed resolved keymap so defaults can be validated once, dispatch can ask for an action by context, and help text can describe the same bindings the runtime actually uses. That is the stable base for future configurable keybindings without keeping parallel shortcut implementations alive.

The plan rendering fix addresses a related planning workflow issue: generated .claude/plans/* files are review artifacts, not ordinary noisy tool output. They should render as complete markdown while the generic cap remains in place for normal tool bodies and diffs.

Closes #140

Validation

  • Automated:
    • cargo fmt --all -- --check
    • cargo check --offline
    • cargo clippy --all-targets --all-features -- -D warnings
    • cargo test
    • cargo test tool_call::tests::
  • Manual: Not run
  • Screenshot/video (if UI changed): not captured; keyboard dispatch, help text, inline prompt behavior, and tool rendering are covered by automated tests

Notes

  • Breaking changes: default permission and plan approval prompts no longer use legacy raw letter/Ctrl quick-approval shortcuts; they use focused option navigation plus confirm/cancel actions through the resolved keymap
  • Docs updated: N/A

srothgan added 3 commits May 21, 2026 16:11
- Add canonical key specs, action descriptors, contexts, and conflict-validated defaults
- Route chat input, autocomplete, permission, question, and runtime key handling through semantic actions
- Implement readline-style editing, Ctrl+C clear-or-quit, prompt arrow/Enter controls, and Unix suspend
- Generate shortcut help from the resolved keymap instead of duplicated static rows
- Cover key parsing, resolution, prompt behavior, runtime actions, and generated help with tests
- Remove obsolete raw permission and question key adapters
- Drop unimplemented keymap placeholder actions and contexts
- Remove unused release-to-child runtime command path
- Keep tests focused on the production keymap executor path
- Add explicit bounded/unbounded tool body height policy
- Render .claude/plans/* markdown bodies without the generic tool height cap
- Keep normal write diffs capped to avoid flooding tool output
- Add regression tests for long plan rendering and non-plan diff capping
@srothgan srothgan self-assigned this May 21, 2026
@srothgan srothgan added the type: enhancement New feature or improvement label May 21, 2026
@srothgan srothgan merged commit 3bd07ca into main May 21, 2026
9 checks passed
@srothgan srothgan deleted the feat/keybindings-keymap branch May 21, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement New feature or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Ctrl-Z should suspend it (and other bad UX)

1 participant