Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): prevent duplicate terminal paste #8457

ClosedAdamulek123(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/8457/headopened View on GitHub

Showing 2 changed files with 73 additions and 10 deletions.

x
0 of 2 viewed, 2 left
64 additions and 0 deletionsapps/web/src/terminal/ghostty/surface.test.tsModified
View file
@@ -4,6 +4,7 @@
import {
DEFAULT_TERMINAL_FONT_FAMILY,
DEFAULT_TERMINAL_FONT_SIZE,
+ GhosttyTerminalSurface,
advanceTerminalSelectionClickSequence,
applyTerminalCopyEvent,
clearPrimedTerminalCopyInput,
@@ -33,6 +34,25 @@
terminalWheelDeltaRows,
} from "./surface";
​
+const terminalSurfaceForPaste = (onData: (data: string) => void) => {
+ const surface = Object.create(GhosttyTerminalSurface.prototype) as GhosttyTerminalSurface;
+ Object.assign(surface, {
+ disposed: false,
+ pasteShortcutToken: 0,
+ options: { onData },
+ core: { encodePaste: (data: string) => `[paste]${data}` },
+ });
+ return surface;
+};
+​
+const deferredClipboardText = () => {
+ let resolve: (text: string) => void = () => {};
+ const promise = new Promise<string>((next) => {
+ resolve = next;
+ });
+ return { promise, resolve };