Skip to content

Ctrl-R is delivered to every split pane #342

@sf-jin-ku

Description

@sf-jin-ku

Summary

When a worktree has multiple split panes, pressing Ctrl-R can be delivered to every pane instead of only the active/focused pane. This is especially visible when multiple Claude Code sessions are running: one inactive pane can receive Ctrl-R and enter a stuck/search-like input state.

Expected

Keyboard input should be routed to the single active Ghostty surface in the key window. Inactive split panes should not forward keyDown, keyUp, or modifier changes to Ghostty.

Actual

performKeyEquivalent already checks that the surface is the window's first responder, but the lower-level keyDown / keyUp / flagsChanged paths did not have the same guard. If those paths are invoked for a stale/non-active surface, that surface can still forward the event to its PTY.

Repro

  1. Open a worktree with two split panes.
  2. Run Claude Code or another TUI in both panes.
  3. Focus one pane.
  4. Press Ctrl-R.
  5. Observe that the inactive pane can also receive Ctrl-R and become stuck / enter an unintended input mode.

Proposed fix

Guard terminal keyboard input at GhosttySurfaceView so only window.firstResponder === self forwards keyboard events to Ghostty, while preserving windowless initialization/test paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions