Skip to content

[BUG] Cmd+V sometimes pastes into the wrong split pane (stale focus routing with Claude Code) #235

@marvtub

Description

@marvtub

Summary

In split-terminal mode, Cmd+V intermittently pastes into a different pane than the one currently focused.

I can click pane B, type in pane B (so focus is clearly there), then press Cmd+V and the paste appears in pane A.

This happens most often while running Claude Code in multiple splits.

Environment

  • Supacode: v0.8.0
  • macOS: Tahoe 26.x
  • Terminal engine: GhosttyKit (embedded)
  • Agent: Claude Code CLI in split panes
  • Repro setup: two or more splits in the same tab

Steps to Reproduce

  1. Open a worktree terminal tab in Supacode.
  2. Split into at least 2 panes (A + B).
  3. Run claude in both panes (or at least one pane).
  4. Click pane B and type a few characters to confirm input goes there.
  5. Press Cmd+V.
  6. Intermittently, paste lands in pane A (or a previously active pane) instead of pane B.

Expected Behavior

Cmd+V should always target the currently focused surface/pane.

Actual Behavior

Paste occasionally goes to a non-focused split pane.

Frequency

Intermittent but recurring during normal multi-pane usage (especially when switching panes quickly while Claude is active).

Why this seems like focus routing (not just Claude)

Related Supacode fixes suggest this may be in split focus state sync:

So this looks like another stale focusedSurface / responder mismatch where key equivalent handling (Cmd+V) is routed to an old surface.

Suggested instrumentation

If helpful, I can test a debug build with logs, but likely useful logs would be:

  • active focusedSurfaceIdByTab at keyDown for Cmd+V
  • NSWindow.firstResponder and target surface ID at dispatch time
  • surface ID that actually receives paste_from_clipboard
  • transitions around split re-layout / pane detach-reattach

Impact

This is high-friction for agent workflows because prompts/snippets can be pasted into the wrong Claude session, causing accidental commands in the wrong terminal context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions