fix(tui): drain Kitty key release events before exit to prevent SSH leak

Adds Terminal.prepareForExit() to disable Kitty protocol and wait for
in-flight release events before fully stopping. This prevents escape
sequences from leaking to the parent shell over slow SSH connections.

Fixes #1204
This commit is contained in:
Mario Zechner 2026-02-03 00:01:39 +01:00
parent c9a20a3aa4
commit 9a4d043b28
5 changed files with 43 additions and 1 deletions

View file

@ -36,6 +36,10 @@ export class VirtualTerminal implements Terminal {
this.xterm.write("\x1b[?2004h");
}
async prepareForExit(_drainMs?: number): Promise<void> {
// No-op for virtual terminal - no Kitty protocol to drain
}
stop(): void {
// Disable bracketed paste mode
this.xterm.write("\x1b[?2004l");