From 36f047064d798507b9177c0651cfbdb3e307e5a8 Mon Sep 17 00:00:00 2001 From: Alejandro Tamayo Date: Fri, 17 Apr 2026 15:36:04 +0200 Subject: [PATCH] Swap Enter/Shift+Enter in agents prompt editor Enter now inserts a newline and Shift+Enter submits (Opt+Shift+Enter force-submits). Applies to both the new-workspace prompt and the active-chat input, since they share AgentsMentionsEditor. Multi-line prompts are much easier to compose without an accidental send. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/renderer/features/agents/main/active-chat.tsx | 2 +- src/renderer/features/agents/main/chat-input-area.tsx | 4 ++-- src/renderer/features/agents/main/new-chat-form.tsx | 2 +- .../features/agents/mentions/agents-mentions-editor.tsx | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/renderer/features/agents/main/active-chat.tsx b/src/renderer/features/agents/main/active-chat.tsx index cf85ed178..f518945bb 100644 --- a/src/renderer/features/agents/main/active-chat.tsx +++ b/src/renderer/features/agents/main/active-chat.tsx @@ -4178,7 +4178,7 @@ const ChatViewInner = memo(function ChatViewInner({ removeFromQueue(subChatId, itemId) }, [subChatId, removeFromQueue]) - // Force send - stop stream and send immediately, bypassing queue (Opt+Enter) + // Force send - stop stream and send immediately, bypassing queue (Opt+Shift+Enter) const handleForceSend = useCallback(async () => { // Block sending while sandbox is still being set up if (sandboxSetupStatus !== "ready") { diff --git a/src/renderer/features/agents/main/chat-input-area.tsx b/src/renderer/features/agents/main/chat-input-area.tsx index 30ad3f25b..7b76b3966 100644 --- a/src/renderer/features/agents/main/chat-input-area.tsx +++ b/src/renderer/features/agents/main/chat-input-area.tsx @@ -151,7 +151,7 @@ export interface ChatInputAreaProps { fileInputRef: React.RefObject // Core callbacks onSend: () => void - onForceSend: () => void // Opt+Enter: stop stream and send immediately, bypassing queue + onForceSend: () => void // Opt+Shift+Enter: stop stream and send immediately, bypassing queue onStop: () => Promise onCompact: () => void onCreateNewSubChat?: () => void @@ -1075,7 +1075,7 @@ export const ChatInputArea = memo(function ChatInputArea({ } // For all other commands (builtin prompts and custom): - // insert the command and let user add arguments or press Enter to send + // insert the command and let user add arguments or press Shift+Enter to send editorRef.current?.setValue(`/${command.name} `) }, [subChatMode, updateMode, onCreateNewSubChat, onCompact, editorRef], diff --git a/src/renderer/features/agents/main/new-chat-form.tsx b/src/renderer/features/agents/main/new-chat-form.tsx index 6f0f61381..d559087d3 100644 --- a/src/renderer/features/agents/main/new-chat-form.tsx +++ b/src/renderer/features/agents/main/new-chat-form.tsx @@ -1386,7 +1386,7 @@ export function NewChatForm({ } // For all other commands (builtin prompts and custom): - // insert the command and let user add arguments or press Enter to send + // insert the command and let user add arguments or press Shift+Enter to send editorRef.current?.setValue(`/${command.name} `) }, [agentMode], diff --git a/src/renderer/features/agents/mentions/agents-mentions-editor.tsx b/src/renderer/features/agents/mentions/agents-mentions-editor.tsx index 548334e42..8fa06f2a6 100644 --- a/src/renderer/features/agents/mentions/agents-mentions-editor.tsx +++ b/src/renderer/features/agents/mentions/agents-mentions-editor.tsx @@ -75,7 +75,7 @@ type AgentsMentionsEditorProps = { placeholder?: string className?: string onSubmit?: () => void - onForceSubmit?: () => void // Opt+Enter: bypass queue, stop stream and send immediately + onForceSubmit?: () => void // Opt+Shift+Enter: bypass queue, stop stream and send immediately disabled?: boolean onPaste?: (e: React.ClipboardEvent) => void onShiftTab?: () => void // callback for Shift+Tab (e.g., mode switching) @@ -1042,13 +1042,13 @@ export const AgentsMentionsEditor = memo( } // Prevent submission during IME composition (e.g., Chinese/Japanese/Korean input) - if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) { + if (e.key === "Enter" && e.shiftKey && !e.nativeEvent.isComposing) { if (triggerActive.current || slashTriggerActive.current) { // Let dropdown handle Enter return } e.preventDefault() - // Opt+Enter = force submit (bypass queue, stop stream and send immediately) + // Opt+Shift+Enter = force submit (bypass queue, stop stream and send immediately) if (e.altKey && onForceSubmit) { onForceSubmit() } else {