fix(app): make prompt submit and newline rebindable#23430
Open
CasualDeveloper wants to merge 1 commit intoanomalyco:devfrom
Open
fix(app): make prompt submit and newline rebindable#23430CasualDeveloper wants to merge 1 commit intoanomalyco:devfrom
CasualDeveloper wants to merge 1 commit intoanomalyco:devfrom
Conversation
1 task
Contributor
There was a problem hiding this comment.
Pull request overview
Adds rebindable keybind support for prompt submission vs newline insertion in the web prompt composer by introducing prompt.submit and prompt.newline commands and switching PromptInput’s Enter handling to keybind matching.
Changes:
- Add two new command titles to the English i18n dictionary.
- Register
prompt.submit/prompt.newlinecommands with default bindings (Enter / Shift+Enter). - Update
PromptInput.handleKeyDownto dispatch submit/newline viamatchKeybind(...)and stop propagation on matches.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/app/src/i18n/en.ts | Adds labels for the two new prompt keybind commands. |
| packages/app/src/components/prompt-input.tsx | Registers new commands and routes Enter handling through configured keybinds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CasualDeveloper
added a commit
to CasualDeveloper/opencode
that referenced
this pull request
Apr 19, 2026
Per Copilot review on anomalyco#23430: registering the commands with their default Enter / Shift+Enter keybinds put them in the global command keymap. When focus was on a non-editable target (a <button>, etc.) the global handler would match, call preventDefault/stopPropagation, and invoke the undefined onSelect \u2014 silently swallowing Enter across the whole app. `disabled: true` excludes them from `keymap()` build in context/command.tsx while the catalog, options, and settings UI still list them (none of those code paths filter by disabled). Local dispatch in prompt-input.tsx is unaffected because handleKeyDown reads keybinds directly from `settings.keybinds`, not from the registered command option.
Register `prompt.submit` (default `enter`) and `prompt.newline` (default `shift+enter`) as web commands so they appear in the existing Settings → Keyboard Shortcuts UI alongside every other rebindable shortcut. `handleKeyDown` in prompt-input.tsx now dispatches via `matchKeybind` against the configured keybinds instead of hardcoded `event.key === "Enter"` checks. Defaults preserve current behavior byte-for-byte. Related: anomalyco#16226, anomalyco#11898, anomalyco#9836
be64e5e to
b7e445b
Compare
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 #16226
Type of change
What does this PR do?
Every shortcut in the web UI is rebindable via Settings → Keyboard Shortcuts — except the one users hit most: Enter / Shift+Enter in the prompt composer.
prompt-input.tsxhardcodesevent.key === "Enter".This PR registers two new web commands so they auto-surface in that settings page under the existing "Prompt" group (grouping is already driven by the
prompt.id prefix insettings-keybinds.tsx):prompt.submit— defaultenterprompt.newline— defaultshift+enterThe two Enter branches in
handleKeyDownnow dispatch viamatchKeybind(submitKeybinds(), event)/matchKeybind(newlineKeybinds(), event)against the configured bindings.event.stopPropagation()after a match so the editor always wins over the global keymap — prevents double-fire if a user picks a modified binding likemod+enter. The IME bail and the Shift+Enter-over-IME ordering are preserved.Defaults match the previous hardcoded behavior byte-for-byte. No new config schema, no new settings UI, no migration. Same underlying ask as #11898 and #9836. (Supersedes #23378 which was auto-closed by the compliance bot for an unchecked "tested locally" box before I had run the manual walkthrough.)
How did you verify your code works?
bun typecheckinpackages/app— clean.bun test src/i18n/parity.test.ts src/components/prompt-input/submit.test.ts— 6 passed, 0 failed.` inserted in editor
world` in editor innerHTML
` inserted in editor
beta` in editor innerHTML
Screenshots / recordings
Before

After

Checklist