From 0814f9515cfa2e964203a9add1dcbe43a7cb66dd Mon Sep 17 00:00:00 2001 From: suraj-markup Date: Sun, 1 Mar 2026 18:46:08 +0530 Subject: [PATCH] fix(terminal): wire OSC 52 clipboard, increase resize cap, fix hardcoded height - Register OSC 52 handler in DirectTerminal to decode base64 clipboard data from tmux and write it to the system clipboard - Increase resize maxAttempts from 10 to 60 so fullscreen toggle works on slow machines with CSS transitions >166ms - Replace hardcoded h-[600px] in Terminal.tsx with responsive max(440px, calc(100vh - 440px)) to prevent overflow on small screens Closes #237 Co-Authored-By: Claude Opus 4.6 --- packages/web/src/components/DirectTerminal.tsx | 16 +++++++++++++++- packages/web/src/components/Terminal.tsx | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/web/src/components/DirectTerminal.tsx b/packages/web/src/components/DirectTerminal.tsx index a4833a611..3a1c9c130 100644 --- a/packages/web/src/components/DirectTerminal.tsx +++ b/packages/web/src/components/DirectTerminal.tsx @@ -148,6 +148,20 @@ export function DirectTerminal({ }, ); + // Register OSC 52 handler for clipboard support + // tmux sends OSC 52 with base64-encoded text when copying + terminal.parser.registerOscHandler(52, (data) => { + const parts = data.split(";"); + if (parts.length < 2) return false; + const b64 = parts[parts.length - 1]; + try { + navigator.clipboard?.writeText(atob(b64)).catch(() => {}); + } catch { + // Ignore decode errors + } + return true; + }); + // Open terminal in DOM terminal.open(terminalRef.current); terminalInstance.current = terminal; @@ -257,7 +271,7 @@ export function DirectTerminal({ } let resizeAttempts = 0; - const maxAttempts = 10; + const maxAttempts = 60; const resizeTerminal = () => { resizeAttempts++; diff --git a/packages/web/src/components/Terminal.tsx b/packages/web/src/components/Terminal.tsx index 4d169d8ab..c64296ea0 100644 --- a/packages/web/src/components/Terminal.tsx +++ b/packages/web/src/components/Terminal.tsx @@ -73,7 +73,7 @@ export function Terminal({ sessionId }: TerminalProps) { {fullscreen ? "exit fullscreen" : "fullscreen"} -
+
{terminalUrl ? (