Repository navigation
Configurable placement for new surfaces - #3898
austinywang wants to merge 16 commits into
Conversation
Surface creation had no cmux-owned insertion policy, so user-facing entry points inherited Bonsplit's implicit after-current behavior. Add app.newSurfacePlacement as the sibling to workspace placement and route terminal, browser, markdown, and file-preview surface creation through one Workspace placement decision while preserving explicit restore/config ordering. Constraint: Do not run local tests or xcodebuild for this task; CI owns test execution. Constraint: Existing Bonsplit createTab only exposes current/end behavior, so cmux applies start/end policies as a post-create reorder before focus reconciliation. Rejected: Configure Bonsplit globally | it cannot express top/start and would affect restoration/configuration paths that need explicit ordering. Confidence: medium Scope-risk: moderate Directive: Keep user-initiated surface creation on the shared Workspace placement path; pass explicit placement overrides for restore/config flows that must preserve stored order. Tested: git diff --check; jq empty Resources/Localizable.xcstrings; jq empty web/data/cmux.schema.json Not-tested: Local unit/UI tests and local app build per user instruction; CI pending.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR implements ChangesConfigurable new surface placement
Sequence DiagramsequenceDiagram
participant User as User action
participant Workspace as Workspace
participant SelectionCapture as Selection<br/>capture
participant CreateTab as CreateTab
participant PlacementHelper as applyNew<br/>SurfacePlacement
participant Reorder as reorderTab
User->>Workspace: newTerminalSurface<br/>(placementOverride)
Workspace->>SelectionCapture: capture<br/>selectionBeforeCreation
Workspace->>CreateTab: createTab
CreateTab->>PlacementHelper: call with<br/>placement state
PlacementHelper->>PlacementHelper: compute insertionIndex<br/>via SurfacePlacementSettings
PlacementHelper->>Reorder: reorder tab<br/>to computed index
Reorder-->>User: tab positioned
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 inconclusive)
✅ Passed checks (14 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merge origin/main after opening the PR so CI evaluates the surface-placement changes against the current base branch rather than stale app and IME test code. Constraint: iterate-pr requires syncing the PR branch with the base branch before CI iteration. Rejected: Rebase after publishing | preserving the opened PR branch history is less disruptive for review and CI. Confidence: high Scope-risk: moderate Directive: Do not revert the merged base changes; they are upstream main updates required for current CI. Tested: git merge origin/main completed without conflicts. Not-tested: Local tests/build per user instruction.
Greptile SummaryThis PR adds a configurable
Confidence Score: 5/5Safe to merge — placement changes are well-scoped, restore/repair flows are explicitly pinned to append, and the new logic is covered by both unit and end-to-end ordering tests. All four surface-creation paths now use a single applyNewSurfacePlacement function or an explicit targetIndex, eliminating the old create-then-reorder pattern. Restore and scaffold paths are guarded with explicit .end overrides so saved workspace ordering cannot be disrupted. Localization is complete across all 19 supported locales. The two flagged items are minor API-contract notes that do not affect current behavior. Sources/Workspace.swift — the insertionIndexToRight access-level promotion and the silent targetIndex/placementOverride precedence in newBrowserSurface are worth a second look, though neither affects current behavior. Important Files Changed
Reviews (10): Last reviewed commit: "fix: localize surface placement strings" | Re-trigger Greptile |
|
Addressed Greptile's double-reorder feedback in 9eb7a0c. Explicit to-right creation now passes a target index into the surface creation path, so terminal/browser/duplicate-browser creation uses either an explicit target placement or the configured global placement, not both; the top-placement test now uses the helper lifecycle directly. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit faff724. Configure here.

Summary
app.newSurfacePlacementwithtop,afterCurrent, andendsupport in schema, settings UI,cmux.jsonparsing, and docs example.Fixes #3760
Testing
git diff --checkjq empty Resources/Localizable.xcstringsjq empty web/data/cmux.schema.jsonLocal tests/build were not run per task instruction; CI will run tests.
Note
Medium Risk
Changes core tab/surface creation and ordering logic across terminal/browser/markdown/file-preview surfaces, which could affect tab ordering and pinning behaviors if edge cases are missed, but is localized and covered by new unit tests.
Overview
Adds a new user/config-managed setting,
app.newSurfacePlacement, to control where newly created surfaces (tabs) are inserted within a pane (top,afterCurrent,end), including UI picker, settings search aliases, schema/docs updates, and full localization strings.Refactors surface creation so terminal/browser/markdown/file-preview surfaces apply a single placement decision at creation time (optionally via explicit
targetIndex/placementOverride), ensuring restoration/internal repair flows always append and that socket/context-menu “to right” actions behave consistently. Adds unit tests covering placement parsing and insertion/index behavior, including pinned-tab interactions and browser profile inheritance for anchored actions.Reviewed by Cursor Bugbot for commit eaef6e6. Bugbot is set up for automated code reviews on this repo. Configure here.