Skip to content

Commit 97f62c5

Browse files
committed
feat(web): mod+alt+enter on an existing thread sends and opens a new thread
1 parent c5a929e commit 97f62c5

7 files changed

Lines changed: 31 additions & 6 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8743,7 +8743,9 @@ export default function ChatView(props: ChatViewProps) {
87438743
}
87448744
beginLocalDispatch({
87458745
preparingWorktree: multipleModelSelections !== null || Boolean(baseBranchForWorktree),
8746-
submissionIntent,
8746+
// Only a draft has a background submission to hide behind its hero.
8747+
submissionIntent:
8748+
submissionIntent === "background" && !isLocalDraftThread ? "foreground" : submissionIntent,
87478749
});
87488750
setWorktreeSetupRef(
87498751
multipleModelSelections === null && baseBranchForWorktree
@@ -9316,6 +9318,12 @@ export default function ChatView(props: ChatViewProps) {
93169318
}),
93179319
);
93189320
}
9321+
} else if (
9322+
submissionIntent === "background" &&
9323+
currentRouteThreadKeyRef.current === routeThreadKey
9324+
) {
9325+
// An existing thread keeps running; open a fresh composer like a draft does.
9326+
handleNewThreadInActiveProject();
93199327
}
93209328
}
93219329
}

‎apps/web/src/components/settings/KeybindingsSettings.logic.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ export function buildKeybindingCommandOptions(
314314
export function commandLabel(command: KeybindingCommand): string {
315315
if (command === "composer.sendAlternate") return "Composer: Opposite Queue or Steer Action";
316316
if (command === "composer.sendBackground") return "Composer: Start in Background";
317+
if (command === "composer.sendAndNewThread") return "Composer: Send and Start New Thread";
317318
if (command === "thread.steerQueuedMessage") return "Queue: Send First Queued Message as Steer";
318319
if (command === "thread.editQueuedMessage") return "Queue: Edit Last Queued Message";
319320
if (command === "thread.copyReference") return "Pull Request: Copy Link or Thread ID";

‎apps/web/src/composer-logic.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@ describe("composerSubmissionIntentForKey", () => {
124124
event: { ...modEnter, altKey: true },
125125
}),
126126
).toBe("background");
127+
expect(
128+
composerSubmissionIntentForKey({
129+
...input,
130+
platform,
131+
sendShortcut,
132+
event: { ...modEnter, altKey: true },
133+
}),
134+
).toBe("background");
127135
expect(
128136
composerSubmissionIntentForKey({
129137
...input,

‎apps/web/src/composer-logic.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export function composerSubmissionIntentForKey(input: {
5959
});
6060
if (command === "composer.sendAlternate" && input.isRunning) return "alternate";
6161
if (command === "composer.sendBackground" && input.isDraftThread) return "background";
62+
if (command === "composer.sendAndNewThread" && !input.isDraftThread) return "background";
6263
if (command !== null || event.key !== "Enter" || event.shiftKey || event.altKey) return null;
6364
if (
6465
composerRequiresModifier(input.sendShortcut, input.prompt ?? "") &&

‎docs/user/keybindings.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ inserts a new line. This applies to the web and desktop composer at desktop widt
1111

1212
**Follow-up behavior** chooses Queue or Steer while the agent runs. Use
1313
`mod+Enter` to do the opposite for one message, even when the send shortcut
14-
requires a modifier. In a new thread, `mod+Alt+Enter` starts the thread in the
15-
background and opens a fresh composer. Change either shortcut in
16-
**Settings → Keybindings** under **Composer: Opposite Queue or Steer Action** or
17-
**Composer: Start in Background**. These bindings take priority over the send
18-
shortcut. Click the send button to use the configured follow-up behavior.
14+
requires a modifier. `mod+Alt+Enter` sends and opens a fresh new-thread
15+
composer; in a new thread, that thread starts in the background. Change these
16+
shortcuts in **Settings → Keybindings** under **Composer: Opposite Queue or
17+
Steer Action**, **Composer: Start in Background**, or **Composer: Send and Start
18+
New Thread**. These bindings take priority over the send shortcut. Click the
19+
send button to use the configured follow-up behavior.
1920

2021
When an active turn has queued messages, `mod+Shift+Enter` sends the first as a
2122
steer. Change it under **Queue: Send First Queued Message as Steer** in Keybindings.

‎packages/contracts/src/keybindings.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export const STATIC_KEYBINDING_COMMANDS = [
8787
"composer.stash",
8888
"composer.sendAlternate",
8989
"composer.sendBackground",
90+
"composer.sendAndNewThread",
9091
"composer.host",
9192
"composer.effort",
9293
"composer.mode",

‎packages/shared/src/keybindings.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ export const DEFAULT_KEYBINDINGS: ReadonlyArray<KeybindingRule> = [
5353
command: "composer.sendBackground",
5454
when: "composerFocus && draftThreadRoute",
5555
},
56+
{
57+
key: "mod+alt+enter",
58+
command: "composer.sendAndNewThread",
59+
when: "composerFocus && !draftThreadRoute",
60+
},
5661
{ key: "mod+n", command: "chat.new", when: "!terminalFocus" },
5762
{ key: "mod+shift+o", command: "chat.new", when: "!terminalFocus" },
5863
{ key: "mod+shift+n", command: "chat.newLocal", when: "!terminalFocus" },

0 commit comments

Comments
 (0)