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): preserve native terminal paste shortcuts · pingdotgg/t3code@1324888

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src
    • components
      • ThreadTerminalDrawer.tsx
    • terminal/ghostty
      • surface.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: apps/web/src/components/ThreadTerminalDrawer.tsx
+10-1Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ import {
5454
} from "~/lib/selectionActions";
5555
import {
5656
GhosttyTerminalSurface,
57+
isTerminalPasteShortcut,
5758
type GhosttyTerminalSurfaceOptions,
5859
} from "~/terminal/ghostty/surface";
60+
import { isEditableFocused } from "~/lib/editableFocus";
5961
import { type GhosttyColor, type GhosttyTheme } from "~/terminal/ghostty/core";
6062
import { useOpenInPreferredEditor } from "../editorPreferences";
6163
import { resolvePathLinkTarget } from "@t3tools/shared/fileLinks";
@@ -939,7 +941,13 @@ function TerminalSessionViewport({
939941

940942
function handleBeforeKey(event: KeyboardEvent): boolean {
941943
const currentKeybindings = readKeybindings();
942-
const options = { context: { terminalFocus: true, terminalOpen: true } };
944+
const options = {
945+
context: {
946+
terminalFocus: true,
947+
terminalOpen: true,
948+
editableFocus: isEditableFocused(event.target),
949+
},
950+
};
943951
if (preventTerminalCloseShortcut(event, currentKeybindings)) {
944952
return false;
945953
}
@@ -955,6 +963,7 @@ function TerminalSessionViewport({
955963

956964
const clipboardCommand = resolveShortcutCommand(event, currentKeybindings, options);
957965
if (clipboardCommand === "terminal.copy" || clipboardCommand === "terminal.paste") {
966+
if (clipboardCommand === "terminal.paste" && isTerminalPasteShortcut(event)) return true;
958967
event.preventDefault();
959968
event.stopPropagation();
960969
clearSelectionAction();
Collapse file

‎apps/web/src/terminal/ghostty/surface.ts‎

Copy file name to clipboardExpand all lines: apps/web/src/terminal/ghostty/surface.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ export function applyTerminalCopyEvent(
338338
return { preventDefault: true, claimWriteFallback: true };
339339
}
340340

341-
function isTerminalPasteShortcut(
341+
export function isTerminalPasteShortcut(
342342
event: Pick<KeyboardEvent, "ctrlKey" | "key" | "metaKey" | "shiftKey">,
343343
platform = navigator.platform,
344344
) {

0 commit comments

Comments
0 (0)
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.