We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b23aa76 + 32aadbb commit af9f2b3Copy full SHA for af9f2b3
1 file changed
app/terminal/terminal.tsx
@@ -121,6 +121,22 @@ export function useTerminal(props: TerminalProps) {
121
122
term.open(terminalRef.current);
123
124
+ // https://github.com/xtermjs/xterm.js/issues/2478
125
+ // my.code();ではCtrl+Cでのkeyboardinterruptは要らないので、コピーペーストに置き換えてしまう
126
+ term.attachCustomKeyEventHandler((arg) => {
127
+ if (arg.ctrlKey && (arg.key === "c" || arg.key === "x") && arg.type === "keydown") {
128
+ const selection = term.getSelection();
129
+ if (selection) {
130
+ navigator.clipboard.writeText(selection);
131
+ return false;
132
+ }
133
134
+ if (arg.ctrlKey && arg.key === "v" && arg.type === "keydown") {
135
136
137
+ return true;
138
+ });
139
+
140
setTermReady(true);
141
onReadyRef.current?.();
142
}
0 commit comments