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 <noreply@anthropic.com>
This commit is contained in:
suraj-markup 2026-03-01 18:46:08 +05:30
parent 4cda43795b
commit 0814f9515c
2 changed files with 16 additions and 2 deletions

View File

@ -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++;

View File

@ -73,7 +73,7 @@ export function Terminal({ sessionId }: TerminalProps) {
{fullscreen ? "exit fullscreen" : "fullscreen"}
</button>
</div>
<div className={cn("w-full", fullscreen ? "h-[calc(100vh-40px)]" : "h-[600px]")}>
<div className="w-full" style={{ height: fullscreen ? "calc(100vh - 40px)" : "max(440px, calc(100vh - 440px))" }}>
{terminalUrl ? (
<iframe
src={terminalUrl}