MCPcopy Create free account
hub / github.com/arctic-cli/interface / handleCopyClick

Function handleCopyClick

packages/arctic/src/cli/cmd/tui/app.tsx:890–905  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected