()
| 888 | }) |
| 889 | |
| 890 | const handleCopyClick = async () => { |
| 891 | if (lastSelectionText) { |
| 892 | // Use OSC 52 escape sequence for clipboard (works in modern terminals without external tools) |
| 893 | const base64 = Buffer.from(lastSelectionText).toString("base64") |
| 894 | const osc52 = `\x1b]52;c;${base64}\x07` |
| 895 | const finalOsc52 = process.env["TMUX"] ? `\x1bPtmux;\x1b${osc52}\x1b\\` : osc52 |
| 896 | /* @ts-expect-error */ |
| 897 | renderer.writeOut(finalOsc52) |
| 898 | // Also try native clipboard as fallback |
| 899 | await Clipboard.copy(lastSelectionText).catch(() => |
| 900 | toast.show({ message: "Failed to copy", variant: "error", duration: 2000 }), |
| 901 | ) |
| 902 | renderer.clearSelection() |
| 903 | setShowCopyButton(false) |
| 904 | } |
| 905 | } |
| 906 | |
| 907 | return ( |
| 908 | <box |
nothing calls this directly
no outgoing calls
no test coverage detected