fix(app): add Ctrl+C/V clipboard support for Windows/Linux terminal

On non-Mac platforms, Ctrl+C now copies selected text to clipboard
(falling through to SIGINT when nothing is selected) and Ctrl+V
pastes from clipboard into the terminal.
This commit is contained in:
Mohamed Boudra
2026-04-03 18:58:10 +07:00
parent cacbbf4053
commit 1e64dd5509
@@ -286,6 +286,25 @@ export class TerminalEmulatorRuntime {
}
if (!isMac && event.ctrlKey && !event.shiftKey && !event.altKey && !event.metaKey) {
const key = event.key.toLowerCase();
// Ctrl+C: copy selection to clipboard if text is selected, otherwise let xterm send SIGINT
if (key === "c" && terminal.hasSelection()) {
void navigator.clipboard.writeText(terminal.getSelection());
return false;
}
// Ctrl+V: paste from clipboard into terminal
if (key === "v") {
event.preventDefault();
void navigator.clipboard.readText().then((text) => {
if (text) {
terminal.paste(text);
}
});
return false;
}
return true;
}