feat: "Return to submit" keyboard preference (Enter to send, Shift+Enter for newline)#33
Merged
Conversation
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.
What
Adds an optional "Return to submit" preference (Settings → General). When on, a bare Return submits and Shift+Return inserts a newline. Everywhere the app currently uses ⌘+Return to submit. Off by default, so nothing changes for existing users unless they opt in.
Closes #32.
Why
⌘+Return-to-submit isn't discoverable and doesn't match the muscle memory of chat-style apps. This makes Enter-to-send a global, opt-in preference rather than an Ask-AI-only tweak.
Where it applies
All six submit surfaces, driven by one shared decision:
How
The submit-vs-newline rule lives in one pure function,
WindowController.returnSubmitsPrompt(...), consulted by both keyboard substrates: the floating-window key monitor (Ask AI / follow-up / MCP) andForwardingTextView(theMultilineTextEditorforms). Rule: only a bare Return submits; Shift/Option/Control+Return insert a newline; ⌘+Return always submits. The setting (CaiSettings.pressReturnToSend) lives in General with a symbol subtitle.Testing
EnterToSendTests— 8 cases over the pure predicate (off/on, bare vs Shift/Option/Control/CapsLock, in/out of a submit screen).Notes