Skip to content

Commit 5e1d55f

Browse files
authored
Now checking for the meta (Command) key as well as the ctrl key (#3484)
1 parent 7ef5a2d commit 5e1d55f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

frontend/src/hooks/useTerminal.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,21 @@ export const useTerminal = (commands: Command[] = []) => {
5555
}
5656
});
5757
terminal.current.attachCustomKeyEventHandler((arg) => {
58-
if (arg.ctrlKey && arg.code === "KeyV" && arg.type === "keydown") {
58+
if (
59+
(arg.ctrlKey || arg.metaKey) &&
60+
arg.code === "KeyV" &&
61+
arg.type === "keydown"
62+
) {
5963
navigator.clipboard.readText().then((text) => {
6064
terminal.current?.write(text);
6165
commandBuffer += text;
6266
});
6367
}
64-
if (arg.ctrlKey && arg.code === "KeyC" && arg.type === "keydown") {
68+
if (
69+
(arg.ctrlKey || arg.metaKey) &&
70+
arg.code === "KeyC" &&
71+
arg.type === "keydown"
72+
) {
6573
const selection = terminal.current?.getSelection();
6674
if (selection) {
6775
const clipboardItem = new ClipboardItem({

0 commit comments

Comments
 (0)