From a7a09145ffee236e3277968cef5cb7dccba4fb20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=AE=AE=E0=AE=A9=E0=AF=8B=E0=AE=9C=E0=AF=8D=E0=AE=95?= =?UTF-8?q?=E0=AF=81=E0=AE=AE=E0=AE=BE=E0=AE=B0=E0=AF=8D=20=E0=AE=AA?= =?UTF-8?q?=E0=AE=B4=E0=AE=A9=E0=AE=BF=E0=AE=9A=E0=AF=8D=E0=AE=9A=E0=AE=BE?= =?UTF-8?q?=E0=AE=AE=E0=AE=BF?= Date: Wed, 21 Aug 2024 19:23:04 +0530 Subject: [PATCH] Implement Ctrl+C --- frontend/src/hooks/useTerminal.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/hooks/useTerminal.ts b/frontend/src/hooks/useTerminal.ts index c267799bd5af..571a75322cb2 100644 --- a/frontend/src/hooks/useTerminal.ts +++ b/frontend/src/hooks/useTerminal.ts @@ -65,6 +65,14 @@ export const useTerminal = (commands: Command[] = []) => { } }); terminal.current.attachCustomKeyEventHandler((arg) => { + // ctrl + c to interrupt + if ( + (arg.ctrlKey || arg.metaKey) && + arg.code === "KeyC" && + arg.type === "keydown" + ) { + sendTerminalCommand("\x03"); + } if ( (arg.ctrlKey || arg.metaKey) && arg.code === "KeyV" &&