feat: add Cmd+Shift+E keyboard shortcut for equalize splits - #1701
songhanlin wants to merge 2 commits into
Conversation
Add native keyboard shortcut support for equalizing split panes. The equalize algorithm now uses leaf-weight-based ratios (matching ghostty's implementation) instead of naively setting all dividers to 0.5, which produced uneven layouts with nested splits.
|
@songhanlin is attempting to deploy a commit to the Manaflow Team on Vercel. A member of the Team first needs to authorize it. |
|
To use Codex here, create a Codex account and connect to github. |
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds an "Equalize Splits" feature: localization entry, new keyboard shortcut (Cmd+Shift+E), command-palette mapping, and weighted split equalization logic in the tab manager that sets divider positions based on leaf-weighted ratios. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App as AppDelegate/ContentView
participant Tab as TabManager
participant Tree as SplitTree
User->>App: Trigger shortcut / command (equalizeSplits)
App->>Tab: tabManager.equalizeSplits(tabId)
Tab->>Tree: traverse splits (equalizeSplits)
Tree->>Tab: compute weights via weightForDirection
Tab->>Tree: setDividerPosition(ratio)
Tab->>Tree: recurse into child splits
Tab-->>App: done
App-->>User: UI updated
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
There was a problem hiding this comment.
No issues found across 5 files
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Sources/TabManager.swift`:
- Around line 3343-3354: The comparison in weightForDirection(_:direction:) uses
a case-sensitive string equality (splitNode.orientation == direction) so
mixed-cased orientation values can miscompare; update the comparison to compare
both sides lowercased (e.g., splitNode.orientation.lowercased() ==
direction.lowercased()) so the split branch correctly recurses into
splitNode.first and splitNode.second when orientations match; locate
weightForDirection and splitNode.orientation in TabManager.swift to make this
change and ensure behavior elsewhere remains unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2c25ba91-a90d-4602-8f5a-2af5755f352e
📒 Files selected for processing (5)
Resources/Localizable.xcstringsSources/AppDelegate.swiftSources/ContentView.swiftSources/KeyboardShortcutSettings.swiftSources/TabManager.swift
Add .lowercased() to both operands when comparing split orientation strings to prevent mismatches from mixed-casing values.
Add native keyboard shortcut support for equalizing split panes. The equalize algorithm now uses leaf-weight-based ratios (matching ghostty's implementation) instead of naively setting all dividers to 0.5, which produced uneven layouts with nested splits.
Summary
Testing
Demo Video
For UI or behavior changes, include a short demo video (GitHub upload, Loom, or other direct link).
Review Trigger (Copy/Paste as PR comment)
Checklist
Summary by cubic
Add Cmd+Shift+E and a command palette action to equalize split panes using leaf-weight ratios for consistent layouts with nested splits (matches
ghostty). Fix case-insensitive split orientation comparison to prevent uneven results with mixed casing.Written for commit 7cfdd10. Summary will update on new commits.
Summary by CodeRabbit