From ff339a51d6322014eb6007a6d80fc49ff609e63c Mon Sep 17 00:00:00 2001 From: Rajkamal <90234628+jsrkamal2002@users.noreply.github.com> Date: Tue, 24 Nov 2026 03:47:25 +0530 Subject: [PATCH] fix(terminal): focus the terminal before right-click paste (#11944) --- tabby-terminal/src/api/baseTerminalTab.component.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tabby-terminal/src/api/baseTerminalTab.component.ts b/tabby-terminal/src/api/baseTerminalTab.component.ts index 13a159182..87d445bec 100644 --- a/tabby-terminal/src/api/baseTerminalTab.component.ts +++ b/tabby-terminal/src/api/baseTerminalTab.component.ts @@ -682,6 +682,15 @@ export class BaseTerminalTabComponent

extends Bas || this.config.store.terminal.rightClick === 'clipboard') { const duration = Date.now() - this.rightMouseDownTime if (duration < 250) { + // A right click doesn't fire the `click` event that normally focuses a + // terminal pane, so activate/focus this pane before pasting: the + // clipboard text should land in the prompt under the cursor (and + // subsequent keystrokes should go there) without a prior click. + if (this.parent instanceof SplitTabComponent && !this.parent._allFocusMode && this.parent.getFocusedTab() !== this) { + this.parent.focus(this) + } else { + this.frontend?.focus() + } if (this.config.store.terminal.rightClick === 'paste') { this.paste() } else if (this.config.store.terminal.rightClick === 'clipboard') {