GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add terminal selection copy action by tarik02 · Pull Request #2904 · pingdotgg/t3code

Add terminal selection copy action #2904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
juliusmarminge merged 9 commits into pingdotgg:main from tarik02-org:feat/terminal-context-menu-copy-upstream-main
Jul 18, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

Add terminal selection copy action #2904

Changes from all commits
Commits
Show all changes
9 commits
Select commit Hold shift + click to select a range
7ebecc8
Add terminal selection copy action
tarik02 Jun 2, 2026
20d9786
Merge branch 'main' into feat/terminal-context-menu-copy-upstream-main
tarik02 Jun 17, 2026
948a0cd
Discard changes to apps/web/src/components/ThreadTerminalDrawer.test.ts
juliusmarminge Jun 19, 2026
f8b111e
Merge branch 'main' into feat/terminal-context-menu-copy-upstream-main
juliusmarminge Jul 17, 2026
f24634f
release terminal selection menu before copying
tarik02 Jul 18, 2026
820e554
Merge remote-tracking branch 'upstream/main' into feat/terminal-conte…
tarik02 Jul 18, 2026
0bf347c
fix terminal selection copy lifecycle
tarik02 Jul 18, 2026
003f7ad
infer terminal selection action ids
tarik02 Jul 18, 2026
5d53eb0
Merge branch 'main' into feat/terminal-context-menu-copy-upstream-main
tarik02 Jul 18, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

57 changes: 43 additions & 14 deletions 57 apps/web/src/components/ThreadTerminalDrawer.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
useState,
} from "react";
import { Popover, PopoverPopup, PopoverTrigger } from "~/components/ui/popover";
import { writeTextToClipboard } from "~/hooks/useCopyToClipboard";
import { cn } from "~/lib/utils";
import { type TerminalContextSelection } from "~/lib/terminalContext";
import { useOpenInPreferredEditor } from "../editorPreferences";
Expand Down Expand Up @@ -330,7 +331,7 @@ export function TerminalViewport({
const selectionPointerRef = useRef<{ x: number; y: number } | null>(null);
const selectionGestureActiveRef = useRef(false);
const selectionActionRequestIdRef = useRef(0);
const selectionActionOpenRef = useRef(false);
const selectionActionMenuOpenRef = useRef(false);
const selectionActionTimerRef = useRef<number | null>(null);
const keybindingsRef = useRef(keybindings);
const runtimeEnvKey = useMemo(() => runtimeEnvSignature(runtimeEnv), [runtimeEnv]);
Expand Down Expand Up @@ -417,6 +418,7 @@ export function TerminalViewport({

const readSelectionAction = (): {
position: { x: number; y: number };
clipboardText: string;
selection: TerminalContextSelection;
} | null => {
const activeTerminal = terminalRef.current;
Expand Down Expand Up @@ -445,6 +447,7 @@ export function TerminalViewport({
});
return {
position,
clipboardText: selectionText,
selection: {
terminalId,
terminalLabel: readTerminalLabel(),
Expand All @@ -460,7 +463,7 @@ export function TerminalViewport({
clearSelectionAction();
return;
}
if (selectionActionOpenRef.current) {
if (selectionActionMenuOpenRef.current) {
return;
}
const nextAction = readSelectionAction();
Expand All @@ -469,20 +472,46 @@ export function TerminalViewport({
return;
}
const requestId = ++selectionActionRequestIdRef.current;
selectionActionOpenRef.current = true;
try {
const clicked = await localApi.contextMenu.show(
[{ id: "add-to-chat", label: "Add to chat" }],
selectionActionMenuOpenRef.current = true;
const clicked = await localApi.contextMenu
.show(
[
{ id: "add-to-chat", label: "Add to chat" },
{ id: "copy", label: "Copy" },
],
nextAction.position,
);
if (requestId !== selectionActionRequestIdRef.current || clicked !== "add-to-chat") {
)
.finally(() => {
selectionActionMenuOpenRef.current = false;
});
if (requestId !== selectionActionRequestIdRef.current || clicked === null) {
return;
}
switch (clicked) {
case "add-to-chat":
handleAddTerminalContext(nextAction.selection);
terminalRef.current?.clearSelection();
terminalRef.current?.focus();
return;
case "copy":
try {
await writeTextToClipboard(nextAction.clipboardText, "terminal selection");
} catch (error) {
if (requestId !== selectionActionRequestIdRef.current) {
return;
}
const activeTerminal = terminalRef.current;
if (activeTerminal) {
writeSystemMessage(
activeTerminal,
error instanceof Error ? error.message : "Unable to copy terminal selection",
);
}
}
if (requestId === selectionActionRequestIdRef.current) {
terminalRef.current?.focus();
}
return;
}
handleAddTerminalContext(nextAction.selection);
terminalRef.current?.clearSelection();
terminalRef.current?.focus();
} finally {
selectionActionOpenRef.current = false;
}
};

Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.