Skip to content

Inherit cwd from source pane when splitting#66

Merged
nedtwigg merged 2 commits into
mainfrom
maintain-cwd
May 15, 2026
Merged

Inherit cwd from source pane when splitting#66
nedtwigg merged 2 commits into
mainfrom
maintain-cwd

Conversation

@nedtwigg
Copy link
Copy Markdown
Member

@nedtwigg nedtwigg commented May 15, 2026

Summary

  • Closes split a pane and keep the cwd #4.
  • New panes created via split (" / %, header split buttons, or Cmd/Ctrl+Click on a split icon) spawn with the source pane's last-known cwd. Remote cwds (e.g. an OSC 7 path reported over ssh) are skipped because they aren't usable as a local spawn directory.
  • The inherited cwd rides through setPendingShellOpts alongside the inherited shell selection and is consumed by getOrCreateTerminal on the next platform.spawnPty.
  • Names the previously-inline { shell?; args?; cwd? } shape as PendingShellOpts and shares the vi.stubGlobal setup between the two describe blocks in terminal-registry.alert.test.ts.

Test plan

  • pnpm -C lib test — 46/46 in terminal-registry.alert.test.ts pass, including the two new pending-shell-opts cases.
  • pnpm -C lib exec tsc --noEmit clean.
  • Manual: open a pane, cd somewhere, split it horizontally and vertically — confirm the new pane starts in the same directory.
  • Manual: split an ssh'd pane whose remote cwd was reported via OSC 7 — confirm the new pane falls back to the local default cwd rather than trying to chdir to the remote path.

🤖 Generated with Claude Code

nedtwigg and others added 2 commits May 14, 2026 19:34
When a split is initiated from an existing pane, the new pane spawns
with the source pane's last-known cwd. Remote cwds (e.g. OSC 7 over
ssh) are skipped since they aren't usable as a local spawn directory.

The inherited cwd rides through setPendingShellOpts alongside the
inherited shell selection and is consumed by getOrCreateTerminal on
the next platform.spawnPty.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Extract `PendingShellOpts` interface in terminal-store so the
  `{ shell?; args?; cwd? }` shape stops being repeated across the
  store and the lifecycle module.
- Drop a stale narrative comment in Wall.tsx; tighten the remaining
  one to explain why remote cwds are skipped.
- Hoist the duplicated `vi.stubGlobal` setup in
  terminal-registry.alert.test.ts into shared
  install/uninstallRegistryTestGlobals helpers so the new
  pending-shell-opts describe block reuses the existing setup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 996e0bc
Status: ✅  Deploy successful!
Preview URL: https://41024e5a.mouseterm.pages.dev
Branch Preview URL: https://maintain-cwd.mouseterm.pages.dev

View logs

@nedtwigg nedtwigg merged commit 733ca1b into main May 15, 2026
6 checks passed
@nedtwigg nedtwigg deleted the maintain-cwd branch May 15, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

split a pane and keep the cwd

1 participant