fix(shortcuts): stop Ctrl+PageUp/Down from leaking to xterm

preventDefault on the window-capture listener does not block xterm's
own keydown listener, which translates Ctrl+PageUp/PageDown into
\e[5~ / \e[6~ and writes them to the shell (and trips the terminal
activity indicator). Stop propagation so the event never reaches the
focused terminal.

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Jinjing
2026-04-25 16:49:54 -07:00
co-authored by Orca
parent dc33850c9c
commit fea286353a
+9
View File
@@ -771,7 +771,16 @@ function Terminal(): React.JSX.Element | null {
!e.repeat
) {
if (handleSwitchTerminalTab(e.code === 'PageDown' ? 1 : -1)) {
// Why: stop propagation in addition to preventDefault. Unlike
// Cmd+Shift+]/[ (xterm ignores Meta-modified keys by default),
// xterm actively translates plain Ctrl+PageUp/PageDown into the
// \e[5~ / \e[6~ escape sequences and writes them to the shell.
// preventDefault on the window-capture listener does not stop
// xterm's own keydown listener on its textarea, so we must stop
// the event before it reaches the focused terminal.
e.preventDefault()
e.stopPropagation()
e.stopImmediatePropagation()
}
}
}