Repository navigation
Add embedded split interaction policy - #167
Conversation
📝 WalkthroughWalkthroughThe PR adds configurable divider position ranges and tab interaction controls. Divider constraints propagate from public configuration through split rendering and coordinator calculations. Tab reordering, cross-pane moves, context menus, and shortcut monitoring now follow configuration flags, with coverage added for divider and tab behavior. ChangesConfiguration controls
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Configuration
participant Controller
participant SplitContainerView
participant Coordinator
Configuration->>Controller: configure dividerPositionRange
Controller->>SplitContainerView: pass divider range
SplitContainerView->>Coordinator: update range
Coordinator->>Coordinator: normalize and clamp divider position
sequenceDiagram
participant TabBarView
participant TabDropDelegate
participant BonsplitController
TabBarView->>TabDropDelegate: validate local or external drop
TabDropDelegate->>BonsplitController: evaluate movement flags
BonsplitController->>TabDropDelegate: permit or reject operation
TabDropDelegate->>TabBarView: perform permitted drop
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
Greptile SummaryThis PR adds embedded split interaction controls. The main changes are:
Confidence Score: 4/5The initial split creation path needs a fix before merging.
Sources/Bonsplit/Public/BonsplitConfiguration.swift and the split creation normalization path. Important Files Changed
Reviews (1): Last reviewed commit: "Add embedded split interaction policy" | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Sources/Bonsplit/Internal/Views/SplitContainerView.swift`:
- Around line 625-639: The divider-position update logic incorrectly permits an
out-of-range divider because it compares the clamped value in stateBounds. In
the relevant divider adjustment method, compare the raw currentDividerPixels /
availableSize ratio against the configured bounds (or explicitly reject values
outside stateBounds) before the early return, then clamp and apply the corrected
position. Add a regression test covering a reused split view after its divider
range narrows.
In `@Sources/Bonsplit/Public/BonsplitController.swift`:
- Around line 601-609: Update normalizedInitialDividerPosition(_:) so a nil
position resolves to the midpoint of configuration.dividerPositionRange rather
than remaining nil; preserve clamping for explicit positions and return the
midpoint for empty/default splitPane calls, ensuring the result always respects
the configured bounds.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1dea442a-6c7a-4528-b837-40ebbafc99df
📒 Files selected for processing (10)
Sources/Bonsplit/Internal/Controllers/SplitViewController.swiftSources/Bonsplit/Internal/Views/SplitContainerView.swiftSources/Bonsplit/Internal/Views/SplitNodeView.swiftSources/Bonsplit/Internal/Views/SplitViewContainer.swiftSources/Bonsplit/Internal/Views/TabBarView.swiftSources/Bonsplit/Internal/Views/TabItemView.swiftSources/Bonsplit/Public/BonsplitConfiguration.swiftSources/Bonsplit/Public/BonsplitController.swiftSources/Bonsplit/Public/BonsplitView.swiftTests/BonsplitTests/EmbeddedConfigurationTests.swift
Two follow-ups to manaflow-ai#167's dividerPositionRange contract: - A nil initialDividerPosition fell through to the internal 0.5 fallback, bypassing a configured range that excludes 0.5. The default is now clamped exactly like an explicit position. - syncPosition compared a pre-clamped current ratio, so a divider that physically drifted outside the range (non-drag AppKit resize) satisfied the early return and stayed out of range. The comparison now uses the raw pixel ratio so the re-assert path restores the model position.
Supports embedded split trees that need native pane chrome without outer-window-only interaction surfaces.
Required by manaflow-ai/cmux#7406.
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by cubic
Adds an embedded split interaction policy with opt-in tab context menus, divider bounds, and shortcut hints, enforces tab-move rules across drag/drop and APIs, and clamps initial split positions to the configured range. Defaults are unchanged; required by manaflow-ai/cmux#7406.
New Features
BonsplitConfiguration.allowsTabContextMenuto enable/disable tab context menus (default: true).BonsplitConfiguration.dividerPositionRangeto constrain divider positions (normalized, default: 0.1...0.9). Clamping now honors this plus minimum pane size; initial split positions are clamped to this range.0...1).Bug Fixes
allowTabReorderingandallowCrossPaneTabMovein drag/drop validation, drops, and programmatic moves (reorderTab,moveTab). Manual reorder overlay is gated byallowTabReordering. Added tests to confirm behavior.Written for commit 68158bd. Summary will update on new commits.
Summary by CodeRabbit
New Features
Bug Fixes