From 28f0b86b7d9d13d0e32a0e7d1cd577d103f1d373 Mon Sep 17 00:00:00 2001 From: bench Date: Sun, 20 Sep 2026 17:21:24 -0700 Subject: [PATCH] test(terminal): pin Alt+middle-click to the TUI-owned path off Mac --- ...-mode-middle-click-double-paste.repro.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/renderer/src/components/terminal-pane/issue-21762-tracking-mode-middle-click-double-paste.repro.test.ts b/src/renderer/src/components/terminal-pane/issue-21762-tracking-mode-middle-click-double-paste.repro.test.ts index 4c94083ce64..d6f327a24df 100644 --- a/src/renderer/src/components/terminal-pane/issue-21762-tracking-mode-middle-click-double-paste.repro.test.ts +++ b/src/renderer/src/components/terminal-pane/issue-21762-tracking-mode-middle-click-double-paste.repro.test.ts @@ -187,6 +187,22 @@ describe('issue 21762: middle-click native-paste suppression in mouse-tracking T expect(pane.terminal.focus).not.toHaveBeenCalled() }) + // Guards against collapsing the modifier check to `shiftKey || altKey`: + // off Mac, xterm still forwards an Alt+middle-click, so the TUI pastes. + it('leaves Alt+middle-click on the TUI-owned path off Mac', () => { + const pane = buildTrackedPane('sgr') + const { result } = renderHook(() => useTerminalPaneMobileActions(buildController(pane))) + + const outcome = fireMiddleMouseDown( + result.current.handlePrimarySelectionMiddleMouseDown, + pane.container, + { altKey: true } + ) + + expect(outcome.propagationStopped).toBe(false) + expect(pane.terminal.focus).not.toHaveBeenCalled() + }) + it('stops auxclick propagation too, matching the mousedown handler', () => { const pane = buildTrackedPane('sgr') const { result } = renderHook(() => useTerminalPaneMobileActions(buildController(pane)))