tiletopia/src-tauri/src
megaproxy 8ad51787fc Phase 2: drag-/right-click-a-pane-to-new-window
Right-click any pane's title bar → "Move to new window" pops it into a
fresh tiletopia window with its PTY intact. Same Tauri process; the
PtyManager is shared, so the existing PaneId stays valid and Tauri 2's
process-wide event routing keeps pane://{id}/data flowing into the new
window's XtermPane.

Mechanism (Rust-side, plan-agent's main correction over my draft):
- pty.rs: PtyManager.transferring is a per-pane refcount; kill_pane
  becomes a no-op while it's >0. Source window's React unmount calls
  kill_pane → silently dropped while in flight; target window's
  claim_pane decrements after it has subscribed.
- window_state.rs: per-window workspaces snapshot map +
  debounced-by-tokio aggregate save. Each window pushes its tabs via
  push_window_workspaces; backend writes the merged
  { version: 2, workspaces: [...] } envelope. Non-main windows have
  their entries dropped on CloseRequested so closing a detached window
  discards its tabs (Chrome-style).
- commands: mark_pane_transferring, claim_pane, get_pane_ring (base64
  scrollback ring snapshot), create_pane_window, take_pending_window_init,
  push_window_workspaces.

Frontend:
- XtermPane gets `existingPaneId?: PaneId`: skip spawn, replay ring
  snapshot via term.write before attaching the live data listener,
  resize PTY to this window's grid, claim_pane. Scrollback replay was
  the plan agent's other ship-in-v1 call — without it a transferred
  Claude session looks blank until next prompt repaint.
- LeafPane: onContextMenu opens a fixed-positioned "Move to new
  window" popover. Esc / outside-click dismiss.
- orchestration adds moveToNewWindow + getInitialPaneIdFor; App owns a
  one-shot transferredPaneIdsRef cleared in registerPaneId.
- App mount branches on getCurrentWebviewWindow().label: main loads
  workspace.json as before; non-main calls take_pending_window_init
  and builds a singleton workspace around the adopted leaf.
- MCP mirror + onMcpRequest only run in main (paneIdByLeafRef is per-
  window; Claude sees the main window's current tab as the single
  workspace surface).

pnpm check (tsc -b) clean. 79/79 vitest pass. Rust side authored in
WSL; cargo build needs verification on Windows host before this is
runnable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 18:57:31 +01:00
..
commands.rs Phase 2: drag-/right-click-a-pane-to-new-window 2026-05-28 18:57:31 +01:00
creds.rs Save SSH passwords in Windows Credential Manager and auto-type at prompt 2026-05-25 20:08:31 +01:00
hosts.rs MCP v2 PR-4: add_host + delete_host + extraArgs sanitiser + third SSH safeguard 2026-05-26 16:04:14 +01:00
lib.rs Phase 2: drag-/right-click-a-pane-to-new-window 2026-05-28 18:57:31 +01:00
main.rs Initial scaffold from M1 spike (tiletopia) 2026-05-22 12:31:29 +01:00
mcp.rs Clear cargo warnings: drop v2.1 classifier scaffold, annotate tool_router 2026-05-26 18:59:04 +01:00
mcp_policy.rs Clear cargo warnings: drop v2.1 classifier scaffold, annotate tool_router 2026-05-26 18:59:04 +01:00
pty.rs Phase 2: drag-/right-click-a-pane-to-new-window 2026-05-28 18:57:31 +01:00
window_state.rs Phase 2: drag-/right-click-a-pane-to-new-window 2026-05-28 18:57:31 +01:00