Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Now checking for the meta (Command) key as well as the ctrl key (#3484)

tofarr5e1d55f2a0d5
diff --git a/frontend/src/hooks/useTerminal.ts b/frontend/src/hooks/useTerminal.ts
index d2665d33b5..7919553328 100644
--- a/frontend/src/hooks/useTerminal.ts
+++ b/frontend/src/hooks/useTerminal.ts
@@ -55,13 +55,21 @@ export const useTerminal = (commands: Command[] = []) => {
}
});
terminal.current.attachCustomKeyEventHandler((arg) => {
- if (arg.ctrlKey && arg.code === "KeyV" && arg.type === "keydown") {
+ if (
+ (arg.ctrlKey || arg.metaKey) &&
+ arg.code === "KeyV" &&
+ arg.type === "keydown"
+ ) {
navigator.clipboard.readText().then((text) => {
terminal.current?.write(text);
commandBuffer += text;
});
}
- if (arg.ctrlKey && arg.code === "KeyC" && arg.type === "keydown") {
+ if (
+ (arg.ctrlKey || arg.metaKey) &&
+ arg.code === "KeyC" &&
+ arg.type === "keydown"
+ ) {
const selection = terminal.current?.getSelection();
if (selection) {
const clipboardItem = new ClipboardItem({