szn

Bug 53 — Mouse escape sequence bytes leak to child PTY when pane doesn’t want mouse events

53. Mouse escape sequence bytes leak to child PTY when pane doesn’t want mouse events

File: src/server/server.zig:623–646 Severity: HIGH Status: ✅ FIXED — mouse event handler in server.zig updated to discard all mouse events (handled = true) if session mouse option is disabled, preventing leaks.

.mouse => |m| {
    const mouse_opt = session.options.asFlag("mouse") orelse false;
    if (mouse_opt and m.button == .left) {
        self.handleMouseFocus(m.x, m.y) catch {};
        handled = true;
    }
    const wants_mouse = pane.screen.mode.mouse_standard or
        pane.screen.mode.mouse_button or
        pane.screen.mode.mouse_sgr;
    if (!wants_mouse) {
        handled = true;   // only set here
    }
},

When mouse_opt is false (szn-level mouse disabled) OR button is not .left, handled stays false. Then at line 639:

if (!handled) {
    pty.writeInput(esc_buf.items) catch {};   // raw CSI mouse bytes forwarded to shell
}

Impact: The pane’s child process receives raw \e[<0;40;12M garbage on stdin. In a shell, mostly invisible (shell ignores unknown ESC), but in a REPL or editor that reads raw terminal input, this injects bytes.