feat(tui): add input.intercept API for plugin keydown interception#25666
feat(tui): add input.intercept API for plugin keydown interception#25666rsdrahat wants to merge 1 commit into
Conversation
Enables plugins to intercept keystrokes in the prompt input before default handling runs. This is the foundational API hook needed for vim mode, macro recording, and custom keybinding plugins. - Add intercept.ts shared module with register/dispatch - Dispatch interceptors in prompt component onKeyDown (before all other handling); a handler returning truthy consumes the event - Expose input.intercept() on TuiPluginApi - Add TuiInputInterceptHandler type (ParsedKey + TextareaRenderable)
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potentially related PR: Related PR:
This PR may be related because it addresses vim mode functionality in the prompt input, which is mentioned in PR #25666 as one of the use cases for the new No other duplicate PRs found addressing the exact same |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #1764
Type of change
What does this PR do?
Adds an
input.intercepthook to the TUI plugin API, enabling plugins to intercept keystrokes in the prompt input before default handling runs.This is the foundational API needed to implement vim mode, macro recording, and custom keybinding plugins — without requiring changes to core. The approach uses a simple module-level handler registry. Handlers run in registration order; the first handler returning truthy consumes the key event.
How did you verify your code works?
bun test test/cli/tui/plugin*.test.ts)onKeyDownlogicChecklist