diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx index 549c7c34a7e0..d3801a4a1b10 100644 --- a/packages/opencode/src/cli/cmd/tui/app.tsx +++ b/packages/opencode/src/cli/cmd/tui/app.tsx @@ -185,11 +185,16 @@ export function tui(input: { targetFps: 60, gatherStats: false, exitOnCtrlC: false, + useMouse: !Flag.OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT, useKittyKeyboard: {}, autoFocus: false, openConsoleOnError: 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}`) @@ -833,7 +838,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)