From ba157ccab7166fa1533db1d328b78b95773ee486 Mon Sep 17 00:00:00 2001 From: Callum Alpass Date: Tue, 3 Nov 2026 02:05:13 +1100 Subject: [PATCH] Copy through the clipboard tool when OSC 52 is refused OpenTUI 0.8 throws when asked for OSC 52 while it isn't drawing. --- src/ui/terminalOut.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/terminalOut.ts b/src/ui/terminalOut.ts index 290f85f..d14e9f7 100644 --- a/src/ui/terminalOut.ts +++ b/src/ui/terminalOut.ts @@ -31,7 +31,11 @@ export function desktopNotify(title: string, body: string): void { * desktop through its clipboard tool too, for terminals that ignore OSC 52. */ export function copyText(renderer: CliRenderer, text: string): void { - renderer.copyToClipboardOSC52(text); + try { + renderer.copyToClipboardOSC52(text); + } catch { + // OpenTUI refuses when it isn't drawing (suspended, or a test renderer); the tool may still copy. + } if (process.env.SSH_CONNECTION) return; const tool = process.platform === "darwin" ? ["pbcopy"] : process.env.WAYLAND_DISPLAY ? ["wl-copy"] : process.env.DISPLAY ? ["xclip", "-selection", "clipboard"] : null;