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 — fix(web): add copying terminal selection with ctrl+c in the web app by UtkarshUsername · Pull Request #5638 · pingdotgg/t3code

fix(web): add copying terminal selection with ctrl+c in the web app #5638

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
shivamhwp merged 9 commits into pingdotgg:main from UtkarshUsername:fix/copy-in-terminal
Aug 14, 2026

Uh oh!

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

Merged

fix(web): add copying terminal selection with ctrl+c in the web app #5638

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit Hold shift + click to select a range
9cd5ade
fix(web): terminal copy uses the native copy event
UtkarshUsername Aug 7, 2026
adba30b
fix(web): fall back to clipboard write when webkit omits copy
UtkarshUsername Aug 10, 2026
5be42a7
fix(web): cancel the clipboard write fallback once the copy event fires
UtkarshUsername Aug 11, 2026
ca0c643
fix(web): clear the selection after ctrl+c copies
UtkarshUsername Aug 12, 2026
d86728b
fix(web): guard the post-copy clear and reset the clear flag
UtkarshUsername Aug 12, 2026
7f56ef7
fix(web): only clear the copy flag if the failing gesture owns it
UtkarshUsername Aug 12, 2026
6315570
fix(web): close the terminal selection menu when ctrl+c clears it
UtkarshUsername Aug 12, 2026
e8d7ab1
fix(web): keep terminal menu close scoped to its own menu
UtkarshUsername Aug 12, 2026
7a0d12c
Merge branch 'main' into fix/copy-in-terminal
UtkarshUsername Aug 14, 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
Prev Previous commit
Next Next commit
fix(web): keep terminal menu close scoped to its own menu
handleSelectionChange only calls contextMenu.close while the selection
action menu is actually open, so an unrelated open menu is never
dismissed. A new fallback menu also dismisses any already-open one
instead of orphaning it, keeping close() authoritative.
  • Loading branch information

Uh oh!

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

@UtkarshUsername
UtkarshUsername committed Aug 14, 2026
commit e8d7ab179531261f32e2dc3af1d5b6751e8a5884

There are no files selected for viewing

7 changes: 5 additions & 2 deletions 7 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 @@ -685,8 +685,11 @@ export function TerminalViewport({
}
clearSelectionAction();
// A copy shortcut that clears the selection (Ctrl+C) must also close
// the context menu that appears with the selection.
void localApi?.contextMenu.close();
// the context menu that appears with the selection, but a clear that
// never opened a menu must not dismiss an unrelated one.
if (selectionActionMenuOpenRef.current) {
void localApi?.contextMenu.close();
}
}

const handleMouseUp = (event: MouseEvent) => {
Expand Down
14 changes: 14 additions & 0 deletions 14 apps/web/src/contextMenuFallback.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,18 @@ describe("dismissContextMenu", () => {
dismissContextMenu();
expect(findButton("Rename")).toBeUndefined();
});

it("dismisses the prior menu when a new one opens", async () => {
const firstPromise = showContextMenuFallback([{ id: "first", label: "First" }]);
expect(findButton("First")).toBeTruthy();

const secondPromise = showContextMenuFallback([{ id: "second", label: "Second" }]);

await expect(firstPromise).resolves.toBeNull();
expect(findButton("First")).toBeUndefined();
expect(findButton("Second")).toBeTruthy();

dismissContextMenu();
await expect(secondPromise).resolves.toBeNull();
});
});
6 changes: 6 additions & 0 deletions 6 apps/web/src/contextMenuFallback.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@ export function showContextMenuFallback<T extends string>(
document.addEventListener("pointerdown", onPointerDown, true);
document.addEventListener("contextmenu", onContextMenu, true);
openMenu(items, position?.x ?? 0, position?.y ?? 0, 0);
// Only one fallback menu can be open at a time: a new show must dismiss
// any prior one, or its DOM and listeners leak and close() can only ever
// reach the newest menu.
if (activeContextMenuDismiss) {
activeContextMenuDismiss();
}
activeContextMenuDismiss = dismiss;
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved

Uh oh!

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


requestAnimationFrame(() => {
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.