feat(tui): add input.intercept API for plugin keydown interception#25666
Open
rsdrahat wants to merge 1 commit into
Open
feat(tui): add input.intercept API for plugin keydown interception#25666rsdrahat wants to merge 1 commit into
rsdrahat 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)
Contributor
|
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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