feat: require Cmd/Ctrl+Enter to send in expanded chat composer
Plain Enter now inserts a newline in the expanded composer Cmd/Ctrl+Enter still sends the message Helps avoid accidental sends while writing long prompts
This commit is contained in:
@@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
|
||||
- **Dictation:** speech is now transcribed after you stop recording. The composer shows a live waveform and timer, and long recordings split at pauses instead of cutting words.
|
||||
- Chat: file paths in messages now open from the session's project, even if you last browsed files in another project (thanks to @tomzx).
|
||||
- Diff: creating an inline comment now opens the chat and focuses the composer for your follow-up.
|
||||
- Chat: in the expanded composer, Enter now starts a new line and Cmd/Ctrl+Enter sends, so a long prompt is harder to send by accident.
|
||||
- Providers: expanded support for custom providers.
|
||||
- Small Model: summaries, goal audits, commit messages, and walkthroughs now support more providers.
|
||||
- Git: generated commit messages now match the repository's recent commit style and language.
|
||||
|
||||
@@ -1625,8 +1625,12 @@ const ChatInputComponent: React.FC<ChatInputProps> = ({
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle Enter/Ctrl+Enter based on selected follow-up behavior.
|
||||
if (e.key === 'Enter' && !e.shiftKey && (!isMobile || e.ctrlKey || e.metaKey)) {
|
||||
// Handle Enter/Ctrl+Enter based on selected follow-up behavior. On
|
||||
// mobile, and in desktop focus mode, plain Enter writes a newline and
|
||||
// only Cmd/Ctrl+Enter sends: both are surfaces for composing long
|
||||
// prompts, where an accidental send costs more than an extra keypress.
|
||||
const requiresModifierToSend = isMobile || isDesktopExpanded;
|
||||
if (e.key === 'Enter' && !e.shiftKey && (!requiresModifierToSend || e.ctrlKey || e.metaKey)) {
|
||||
e.preventDefault();
|
||||
|
||||
const isCtrlEnter = e.ctrlKey || e.metaKey;
|
||||
|
||||
Reference in New Issue
Block a user