diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx index 0d5aefe7bc3..6e615fcda04 100644 --- a/packages/opencode/src/cli/cmd/tui/app.tsx +++ b/packages/opencode/src/cli/cmd/tui/app.tsx @@ -168,10 +168,15 @@ export function tui(input: { targetFps: 60, gatherStats: false, exitOnCtrlC: false, + useMouse: !Flag.OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT, useKittyKeyboard: {}, autoFocus: false, consoleOptions: { - keyBindings: [{ name: "y", ctrl: true, action: "copy-selection" }], + keyBindings: [ + { name: "y", ctrl: true, action: "copy-selection" }, + { name: "c", ctrl: true, action: "copy-selection" }, + { name: "c", meta: true, action: "copy-selection" }, + ], onCopySelection: (text) => { Clipboard.copy(text).catch((error) => { console.error(`Failed to copy console selection to clipboard: ${error}`) @@ -692,19 +697,19 @@ function App() { width={dimensions().width} height={dimensions().height} backgroundColor={theme.background} - onMouseUp={async () => { - if (Flag.OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT) { - renderer.clearSelection() - return - } - const text = renderer.getSelection()?.getSelectedText() - if (text && text.length > 0) { - await Clipboard.copy(text) - .then(() => toast.show({ message: "Copied to clipboard", variant: "info" })) - .catch(toast.error) - renderer.clearSelection() - } - }} + onMouseUp={ + !Flag.OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT + ? async () => { + const text = renderer.getSelection()?.getSelectedText() + if (text && text.length > 0) { + await Clipboard.copy(text) + .then(() => toast.show({ message: "Copied to clipboard", variant: "info" })) + .catch(toast.error) + renderer.clearSelection() + } + } + : undefined + } > @@ -735,7 +740,16 @@ function ErrorComponent(props: { useKeyboard((evt) => { if (evt.ctrl && evt.name === "c") { - handleExit() + if (process.platform === "darwin") { + handleExit() + return + } + if (Flag.OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT) { + return + } + if (!renderer.getSelection()?.getSelectedText()) { + handleExit() + } } }) const [copied, setCopied] = createSignal(false)