Skip to content

Commit 96e22cc

Browse files
committed
feat(terminal): copy prompt to clipboard on history bar double-click
Double-clicking the InfoBar above the agent terminal now copies the last prompt to the clipboard with a confirmation toast, instead of filling the prompt input.
1 parent e5992dc commit 96e22cc

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/components/TaskAITerminal.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import {
1515
setActiveTask,
1616
addAgentToTask,
1717
closeAgentInTask,
18+
showNotification,
1819
} from '../store/store';
20+
import { warn as logWarn } from '../lib/log';
1921
import { InfoBar } from './InfoBar';
2022
import { TerminalView } from './TerminalView';
2123
import { Dialog } from './Dialog';
@@ -200,8 +202,12 @@ export function TaskAITerminal(props: TaskAITerminalProps) {
200202
allowOverflow
201203
title={props.task.lastPrompt || infoBarStatus().title}
202204
onDblClick={() => {
203-
if (props.task.lastPrompt && props.promptHandle && !props.promptHandle.getText())
204-
props.promptHandle.setText(props.task.lastPrompt);
205+
const prompt = props.task.lastPrompt;
206+
if (!prompt) return;
207+
navigator.clipboard
208+
.writeText(prompt)
209+
.then(() => showNotification('Prompt copied to clipboard'))
210+
.catch((err: unknown) => logWarn('clipboard', 'writeText failed', { err }));
205211
}}
206212
>
207213
<div

0 commit comments

Comments
 (0)