Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

merge PR #137: fix(terminal): strip the CLI's quote rail from copied selections

Chaitanya Giri4c0dba2de747
diff --cc package.json
index c974da3b,d3d448fa..42f7ff4a
--- a/package.json
+++ b/package.json
@@@ -19,7 -19,7 +19,7 @@@
"typecheck:node": "tsc --noEmit -p tsconfig.node.json",
"typecheck:web": "tsc --noEmit -p tsconfig.web.json",
"typecheck": "npm run typecheck:node && npm run typecheck:web",
- "test:focused": "node --test test/codex-remote.test.cjs test/control.test.cjs test/provider-automation.test.cjs test/provider-config.test.cjs test/queue-delivery.test.cjs test/terminal-automation.test.cjs test/terminal-recovery.test.cjs test/roster.test.cjs test/proc-kill.test.cjs test/expand-tilde.test.cjs test/hive-cwd.test.cjs test/hive-task-mutation.test.cjs test/hive-hook-node.test.cjs test/hive-roster-injection.test.cjs test/hive-runtime-path.test.cjs test/cli-install-ladder.test.cjs test/node-install.test.cjs test/office-gl-recovery.test.cjs test/update-state.test.cjs test/transcript-project-dir.test.cjs test/commit-graph.test.cjs",
- "test:focused": "node --test test/codex-remote.test.cjs test/control.test.cjs test/provider-automation.test.cjs test/provider-config.test.cjs test/queue-delivery.test.cjs test/terminal-automation.test.cjs test/terminal-recovery.test.cjs test/terminal-selection.test.cjs test/roster.test.cjs test/proc-kill.test.cjs test/expand-tilde.test.cjs test/hive-cwd.test.cjs test/hive-hook-node.test.cjs test/hive-roster-injection.test.cjs test/hive-runtime-path.test.cjs test/cli-install-ladder.test.cjs test/node-install.test.cjs test/office-gl-recovery.test.cjs test/update-state.test.cjs test/transcript-project-dir.test.cjs test/commit-graph.test.cjs",
++ "test:focused": "node --test test/codex-remote.test.cjs test/control.test.cjs test/provider-automation.test.cjs test/provider-config.test.cjs test/queue-delivery.test.cjs test/terminal-automation.test.cjs test/terminal-recovery.test.cjs test/terminal-selection.test.cjs test/roster.test.cjs test/proc-kill.test.cjs test/expand-tilde.test.cjs test/hive-cwd.test.cjs test/hive-task-mutation.test.cjs test/hive-hook-node.test.cjs test/hive-roster-injection.test.cjs test/hive-runtime-path.test.cjs test/cli-install-ladder.test.cjs test/node-install.test.cjs test/office-gl-recovery.test.cjs test/update-state.test.cjs test/transcript-project-dir.test.cjs test/commit-graph.test.cjs",
"check:links": "node tools/check-release-links.cjs",
"dist": "npm run build && electron-builder",
"dist:mac": "npm run build && electron-builder --mac",
diff --cc src/renderer/src/components/terminalPool.ts
index 5e6fbd76,30d48ef8..8462b903
--- a/src/renderer/src/components/terminalPool.ts
+++ b/src/renderer/src/components/terminalPool.ts
@@@ -181,27 -182,17 +182,33 @@@ export function acquireTerminal(ptyId:
// right-click → copy the selection, else paste (console style)
const copySelection = (): boolean => {
if (!term.hasSelection()) return false;
- void window.cth.copyToClipboard(term.getSelection());
+ // Selections come off the character GRID, so any gutter the CLI painted
+ // there (Claude Code renders a blockquote as `▎ text`) is part of the
+ // copied cells. Strip it — see terminalSelection.ts.
+ const text = sanitizeTerminalSelection(term.getSelection());
+ // Still `true` when a rail-only selection sanitizes to nothing: the gesture
+ // was a copy and must stay one, or right-click would fall through to paste.
+ if (text) void window.cth.copyToClipboard(text);
return true;
};
+ /** Paste the clipboard into the terminal.
+ *
+ * The read is SYNCHRONOUS on purpose. Dictation tools (muesli.works, Wispr
+ * Flow, …) "type" by stashing the clipboard, writing the transcript, sending
+ * the paste key, and restoring the old clipboard immediately after. The async
+ * read this used to do came back a tick or two later — after the restore — so
+ * the terminal pasted the text that had been on the clipboard BEFORE, and the
+ * words the user had just spoken were dropped. Reading inside the keydown
+ * handler closes that window entirely.
+ *
+ * Falls back to the async read if the sync bridge is unavailable (an older
+ * preload), so this degrades to the previous behaviour rather than to nothing. */
const pasteClipboard = (): void => {
if (entry.exited) return;
+ try {
+ const text = window.cth.readClipboardSync?.();
+ if (typeof text === 'string') { if (text) term.paste(text); return; }
+ } catch { /* fall through to the async path */ }
void window.cth.readClipboard().then((t) => { if (t) term.paste(t); });
};
term.attachCustomKeyEventHandler((ev) => {