add ctrl-shift-c handler for terminal (to copy text)

This commit is contained in:
sawka 2023-11-16 23:11:42 -08:00
parent ad0f11c097
commit bf03ff2591
2 changed files with 7 additions and 2 deletions

View File

@ -117,7 +117,6 @@ class CmdInput extends React.Component<{}, {}> {
<div
ref={this.cmdInputRef}
className={cn("cmd-input", { "has-info": infoShow }, { active: focusVal })}
onClick={this.cmdInputClick}
>
<If condition={historyShow}>
<div className="cmd-input-grow-spacer"></div>

View File

@ -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;
}