Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions app/terminal/terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,22 @@ export function useTerminal(props: TerminalProps) {

term.open(terminalRef.current);

// https://github.com/xtermjs/xterm.js/issues/2478
// my.code();ではCtrl+Cでのkeyboardinterruptは要らないので、コピーペーストに置き換えてしまう
term.attachCustomKeyEventHandler((arg) => {
if (arg.ctrlKey && (arg.key === "c" || arg.key === "x") && arg.type === "keydown") {
const selection = term.getSelection();
if (selection) {
navigator.clipboard.writeText(selection);
return false;
}
}
if (arg.ctrlKey && arg.key === "v" && arg.type === "keydown") {
return false;
}
return true;
});

setTermReady(true);
onReadyRef.current?.();
}
Expand Down