Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Feature/ctrl enter send - #8556

Closed
lmtr0 wants to merge 17 commits into
RooCodeInc:mainfrom
lmtr0:feature/ctrl-enter-send
Closed

Feature/ctrl enter send#8556
lmtr0 wants to merge 17 commits into
RooCodeInc:mainfrom
lmtr0:feature/ctrl-enter-send

Conversation

@lmtr0

@lmtr0 lmtr0 commented Oct 7, 2025

Copy link
Copy Markdown

Related GitHub Issue

Closes: #8555

Description

This PR introduces a new toggle in the settings under the "UI" section that allows users to switch between two input behaviors in the chat prompt editor:

  • Enter = newline, Shift+Enter / Ctrl+Enter = send
  • Enter = send, Shift+Enter = newline (current default)

The change is implemented by listening to the keydown event in the prompt input component and conditionally intercepting the Enter key based on the user’s preference, which is stored via VS Code’s configuration API.

This addresses user pain points around accidental submissions, ergonomic fatigue from holding Shift, and conflicts with input method workflows.

Test Procedure

  • Send a message normally in the chat input
  • Enable the feature
  • Be happy that when you press enter, you receive a new line, and when you press ctrl+enter, the message is sent.
  • Disable the feature
  • Be happy that everything is back to default behavior.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

The settings panel
image

Didn't send the message after pressing enter:
image

Did send it when pressing ctrl+enter
image

Documentation Updates

  • This implementation does not introduce any new hardcoded keybindings beyond using standard modifier combinations (Shift+Enter, Ctrl+Enter), which are already common in chat interfaces.
  • It would be ideal if there are documentation written to allow users to understand how to change the setting, but I think it is very intuitive
  • I do not have time to write docs for this feature

Additional Notes

Get in Touch

Discord: lmtr0


Important

Adds a new setting requireCtrlEnterToSend to toggle input behavior in the chat prompt editor, allowing users to require Ctrl+Enter to send messages.

  • Behavior:
    • Adds requireCtrlEnterToSend setting to toggle input behavior in chat prompt editor.
    • In ChatTextArea.tsx, modifies handleKeyDown to conditionally send messages based on requireCtrlEnterToSend.
  • Settings:
    • Adds requireCtrlEnterToSend to globalSettingsSchema in global-settings.ts.
    • Updates UISettings.tsx to include a checkbox for requireCtrlEnterToSend.
    • Updates SettingsView.tsx to handle requireCtrlEnterToSend state.
  • State Management:
    • Updates ExtensionStateContext.tsx to manage requireCtrlEnterToSend state.
    • Modifies webviewMessageHandler.ts to handle requireCtrlEnterToSend messages.
  • Localization:
    • Adds localization strings for requireCtrlEnterToSend in settings.json.

This description was created by Ellipsis for 9d206cb. You can customize this summary. It will automatically update as commits are pushed.

@lmtr0
lmtr0 requested review from cte, jr and mrubens as code owners October 7, 2025 23:30
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. Enhancement New feature or request UI/UX UI/UX related or focused labels Oct 7, 2025

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some issues that need attention before merge.

Comment thread webview-ui/src/components/chat/ChatTextArea.tsx Outdated
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 7, 2025

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a couple of small issues to address before merging.

Comment thread webview-ui/src/components/chat/ChatTextArea.tsx Outdated
Comment thread webview-ui/src/components/chat/ChatTextArea.tsx
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Oct 8, 2025

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some issues that need attention before merge.

Comment thread webview-ui/src/i18n/locales/en/settings.json Outdated
Comment thread webview-ui/src/i18n/locales/en/settings.json

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found one issue that needs attention before merge.

Comment on lines +1624 to +1627
case "requireCtrlEnterToSend":
await updateGlobalState("requireCtrlEnterToSend", message.bool)
// No need to call postStateToWebview here as the UI already updated optimistically
break

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Setting change doesn't propagate to the webview. The extension updates global state but doesn't notify the frontend, so Chat won't reflect the new behavior until a later state refresh. After updating, also post a message back to the webview so ExtensionStateContext can update immediately.

Suggested change
case "requireCtrlEnterToSend":
await updateGlobalState("requireCtrlEnterToSend", message.bool)
// No need to call postStateToWebview here as the UI already updated optimistically
break
case "requireCtrlEnterToSend":
await updateGlobalState("requireCtrlEnterToSend", message.bool)
await provider.postMessageToWebview({ type: "requireCtrlEnterToSend", bool: message.bool ?? false })
break

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am following the other UI checkbox; the other doesn't do this, so I believe this one shouldn't either.

lmtr0 and others added 2 commits October 7, 2025 22:05
Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some issues that need attention before merge.

Comment thread webview-ui/src/i18n/locales/de/settings.json Outdated

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some issues that need attention before merge.

Comment thread webview-ui/src/i18n/locales/de/settings.json Outdated
@lmtr0
lmtr0 force-pushed the feature/ctrl-enter-send branch from f6e5d9b to 9422644 Compare October 9, 2025 02:29
@lmtr0

lmtr0 commented Oct 31, 2025

Copy link
Copy Markdown
Author

Understood, I'll take a look at this shortly

@lmtr0

lmtr0 commented Nov 1, 2025

Copy link
Copy Markdown
Author

I have addressed the feedback. What do you think of the current changes?

@ghost

ghost commented Nov 1, 2025

Copy link
Copy Markdown

See this task on Roo Code Cloud

Found 1 critical issue remaining:

Critical Issues (Must Fix):

  • Fix Italian locale JSON structure - has duplicate description keys and missing closing brace for collapseThinking object causing JSON parsing errors

Recently Fixed:

  • French locale now correctly uses {primaryMod} placeholder (fixed in commit 0d538a9)
  • German locale uses {primaryMod} placeholder correctly
Previous Reviews

Mention @roomote in a comment to trigger your PR Fixer agent and make changes to this pull request.

Comment thread webview-ui/src/i18n/locales/de/settings.json Outdated
Comment thread webview-ui/src/i18n/locales/fr/settings.json Outdated
Comment thread webview-ui/src/i18n/locales/it/settings.json Outdated
lmtr0 and others added 3 commits November 3, 2025 16:11
Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>
Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>
Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>
@lmtr0

lmtr0 commented Nov 3, 2025

Copy link
Copy Markdown
Author

@daniel-lxs any chance we can get this out?

Comment on lines 886 to 894
"ui": {
"collapseThinking": {
"label": "Comprimi i messaggi di pensiero per impostazione predefinita",
"description": "Se abilitato, i blocchi di pensiero verranno compressi per impostazione predefinita finché non interagisci con essi"
"requireCtrlEnterToSend": {
"label": "Richiedi {primaryMod}+Invio per inviare messaggi",
"description": "Quando abilitato, devi premere {primaryMod}+Invio per inviare messaggi invece di solo Invio"
"description": "Quando abilitato, devi premere Ctrl+Invio per inviare messaggi invece di solo Invio"
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P0] Critical: Invalid JSON structure. The Italian locale file has malformed JSON with missing closing brace for collapseThinking object and duplicate description keys. This will cause JSON parsing errors and break the application.

Suggested change
"ui": {
"collapseThinking": {
"label": "Comprimi i messaggi di pensiero per impostazione predefinita",
"description": "Se abilitato, i blocchi di pensiero verranno compressi per impostazione predefinita finché non interagisci con essi"
"requireCtrlEnterToSend": {
"label": "Richiedi {primaryMod}+Invio per inviare messaggi",
"description": "Quando abilitato, devi premere {primaryMod}+Invio per inviare messaggi invece di solo Invio"
"description": "Quando abilitato, devi premere Ctrl+Invio per inviare messaggi invece di solo Invio"
}
}
"ui": {
"collapseThinking": {
"label": "Comprimi i messaggi di pensiero per impostazione predefinita",
"description": "Se abilitato, i blocchi di pensiero verranno compressi per impostazione predefinita finché non interagisci con essi"
},
"requireCtrlEnterToSend": {
"label": "Richiedi {primaryMod}+Invio per inviare messaggi",
"description": "Quando abilitato, devi premere {primaryMod}+Invio per inviare messaggi invece di solo Invio"
}
}

Comment on lines +890 to +892
"requireCtrlEnterToSend": {
"label": "Erfordert {primaryMod}+Enter zum Senden von Nachrichten",
"description": "Wenn aktiviert, musst du {primaryMod}+Enter drücken, um Nachrichten zu senden, anstatt nur Enter."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Translation inconsistency: German locale still uses hardcoded "Strg+Enter" instead of the dynamic {primaryMod} placeholder. This causes incorrect key combination display for macOS users (should show "Cmd+Enter").

Suggested change
"requireCtrlEnterToSend": {
"label": "Erfordert {primaryMod}+Enter zum Senden von Nachrichten",
"description": "Wenn aktiviert, musst du {primaryMod}+Enter drücken, um Nachrichten zu senden, anstatt nur Enter."
"requireCtrlEnterToSend": {
"label": "Erfordert {primaryMod}+Enter zum Senden von Nachrichten",
"description": "Wenn aktiviert, musst du {primaryMod}+Enter drücken, um Nachrichten zu senden, anstatt nur Enter."

Comment thread webview-ui/src/i18n/locales/fr/settings.json Outdated
Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>
@hannesrudolph

Copy link
Copy Markdown
Contributor

Opened follow-up PR to land fixes since the original is from a fork and not pushable here: #9078

@hannesrudolph

Copy link
Copy Markdown
Contributor

Superseded by #9078

@github-project-automation github-project-automation Bot moved this from New to Done in Roo Code Roadmap Nov 6, 2025
@github-project-automation github-project-automation Bot moved this from PR [Changes Requested] to Done in Roo Code Roadmap Nov 6, 2025
@lmtr0

lmtr0 commented Nov 6, 2025

Copy link
Copy Markdown
Author

Thank you

@drzraf

drzraf commented Dec 16, 2025

Copy link
Copy Markdown

Posted in the other issue (but this one has subscribers):

Whether Enter or Ctrl+Enter is used, Shift+Enter should never send the text: It's been consistently (and almost universally) considered as a way to insert a newline instead of validating.

(please reopen)

@lmtr0

lmtr0 commented Dec 16, 2025

Copy link
Copy Markdown
Author

cc @hannesrudolph

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

Labels

Enhancement New feature or request PR - Changes Requested size:L This PR changes 100-499 lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Chat: Ctrl Enter Send

5 participants