mirror of
https://github.com/stablyai/orca.git
synced 2026-10-15 08:03:08 +00:00
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:
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user