From 9a8962d5c1fc403048dd0866819c669dd8871781 Mon Sep 17 00:00:00 2001 From: alguiraud Date: Fri, 21 Aug 2026 17:27:03 -0400 Subject: [PATCH] fix(web): support Ctrl+V terminal paste on Windows --- apps/web/src/terminal/ghostty/surface.test.ts | 5 +++++ apps/web/src/terminal/ghostty/surface.ts | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/web/src/terminal/ghostty/surface.test.ts b/apps/web/src/terminal/ghostty/surface.test.ts index c11529e0c46c..9f484940edc5 100644 --- a/apps/web/src/terminal/ghostty/surface.test.ts +++ b/apps/web/src/terminal/ghostty/surface.test.ts @@ -247,6 +247,11 @@ describe("isTerminalPasteShortcut", () => { expect(isTerminalPasteShortcut(event({ ctrlKey: true }), "MacIntel")).toBe(false); }); + it("uses Ctrl+V on Windows", () => { + expect(isTerminalPasteShortcut(event({ ctrlKey: true }), "Win32")).toBe(true); + expect(isTerminalPasteShortcut(event({ metaKey: true }), "Win32")).toBe(false); + }); + it("preserves Ctrl+V and uses Ctrl+Shift+V elsewhere", () => { expect(isTerminalPasteShortcut(event({ ctrlKey: true }), "Linux x86_64")).toBe(false); expect(isTerminalPasteShortcut(event({ ctrlKey: true, shiftKey: true }), "Linux x86_64")).toBe( diff --git a/apps/web/src/terminal/ghostty/surface.ts b/apps/web/src/terminal/ghostty/surface.ts index 9492e2d02628..6cd9477f05cd 100644 --- a/apps/web/src/terminal/ghostty/surface.ts +++ b/apps/web/src/terminal/ghostty/surface.ts @@ -1,4 +1,4 @@ -import { isMacPlatform } from "../../lib/utils"; +import { isMacPlatform, isWindowsPlatform } from "../../lib/utils"; import { collectWrappedTerminalLinkLine, extractTerminalLinks } from "../../terminal-links"; import { GhosttyTerminalCore, @@ -345,7 +345,9 @@ export function isTerminalPasteShortcut( return event.shiftKey && !event.ctrlKey && !event.metaKey; } if (key !== "v") return false; - return isMacPlatform(platform) ? event.metaKey : event.ctrlKey && event.shiftKey; + if (isMacPlatform(platform)) return event.metaKey; + if (isWindowsPlatform(platform)) return event.ctrlKey; + return event.ctrlKey && event.shiftKey; } export function isTerminalCompositionCommitInput(event: Pick): boolean {