From 30dfe765774563595f784d6d461e948876778cfc Mon Sep 17 00:00:00 2001 From: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Date: Tue, 3 Dec 2024 00:55:14 +0000 Subject: [PATCH] Allow copy/paste in terminal (#1760) --- src/hooks/bottomPanelTabs/useTerminal.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/hooks/bottomPanelTabs/useTerminal.ts b/src/hooks/bottomPanelTabs/useTerminal.ts index 4885119f5..0709a23bb 100644 --- a/src/hooks/bottomPanelTabs/useTerminal.ts +++ b/src/hooks/bottomPanelTabs/useTerminal.ts @@ -13,6 +13,16 @@ export function useTerminal(element: Ref) { ) terminal.loadAddon(fitAddon) + terminal.attachCustomKeyEventHandler((event) => { + if (event.type === 'keydown' && (event.ctrlKey || event.metaKey)) { + if (event.key === 'c' || event.key === 'v') { + // Allow default browser copy/paste handling + return false + } + } + return true + }) + onMounted(async () => { terminal.open(element.value) })