Skip to content

Conversation

@lmtr0
Copy link

@lmtr0 lmtr0 commented Oct 7, 2025

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
Copy link

@roomote roomote bot left a comment

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.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 7, 2025
Copy link

@roomote roomote bot left a comment

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.

@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
Copy link

@roomote roomote bot left a comment

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.

Copy link

@roomote roomote bot left a comment

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

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
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>
Copy link

@roomote roomote bot left a comment

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.

Copy link

@roomote roomote bot left a comment

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.

@lmtr0 lmtr0 force-pushed the feature/ctrl-enter-send branch from f6e5d9b to 9422644 Compare October 9, 2025 02:29
@hannesrudolph hannesrudolph removed the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 17, 2025
daniel-lxs

This comment was marked as outdated.

Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

Thank you for this PR. It is functionally sound and macOS-compatible (checks event.metaKey).

Suggestions:

  • Platform-aware labels: show "Cmd+Enter" on macOS and "Ctrl+Enter" elsewhere. Update webview-ui/src/components/settings/UISettings.tsx and webview-ui/src/components/chat/ChatTextArea.tsx.

  • i18n: unify strings; prefer a placeholder like {primaryMod}+Enter in webview-ui/src/i18n/locales/en/settings.json and resolve at runtime so locales don't hardcode Ctrl.

  • UX hint: when enabled, show a subtle hint near the input or send button, e.g. "Press Cmd/Ctrl+Enter to send".

Nice work!

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Oct 30, 2025
@lmtr0
Copy link
Author

lmtr0 commented Oct 31, 2025

Understood, I'll take a look at this shortly

@lmtr0
Copy link
Author

lmtr0 commented Nov 1, 2025

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

@roomote
Copy link

roomote bot commented Nov 1, 2025

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.

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
Copy link
Author

lmtr0 commented Nov 3, 2025

@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

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

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."

Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>
@hannesrudolph
Copy link
Collaborator

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

@hannesrudolph
Copy link
Collaborator

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
Copy link
Author

lmtr0 commented Nov 6, 2025

Thank you

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

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

Status: Done

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Chat: Ctrl Enter Send

4 participants