From bf03ff25916df9c2040a37fb074e74579986dd8d Mon Sep 17 00:00:00 2001 From: sawka Date: Thu, 16 Nov 2023 23:11:42 -0800 Subject: [PATCH] add ctrl-shift-c handler for terminal (to copy text) --- src/app/workspace/cmdinput/cmdinput.tsx | 1 - src/model/model.ts | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/workspace/cmdinput/cmdinput.tsx b/src/app/workspace/cmdinput/cmdinput.tsx index 7d17304d..d01eb779 100644 --- a/src/app/workspace/cmdinput/cmdinput.tsx +++ b/src/app/workspace/cmdinput/cmdinput.tsx @@ -117,7 +117,6 @@ class CmdInput extends React.Component<{}, {}> {
diff --git a/src/model/model.ts b/src/model/model.ts index 5009d275..35ae51d1 100644 --- a/src/model/model.ts +++ b/src/model/model.ts @@ -304,7 +304,6 @@ class Cmd { } handleData(data: string, termWrap: TermWrap): void { - // console.log("handle data", {data: data}); if (!this.isRunning()) { return; } @@ -756,6 +755,13 @@ class Screen { } termCustomKeyHandler(e: any, termWrap: TermWrap): boolean { + if (e.type == "keypress" && e.code == "KeyC" && e.shiftKey && e.ctrlKey) { + e.stopPropagation(); + e.preventDefault(); + let sel = termWrap.terminal.getSelection(); + navigator.clipboard.writeText(sel); + return false; + } if (termWrap.isRunning) { return true; }