Skip to content

feat: add Cmd+Shift+E keyboard shortcut for equalize splits - #1701

Open
songhanlin wants to merge 2 commits into
manaflow-ai:mainfrom
songhanlin:main
Open

songhanlin wants to merge 2 commits into
manaflow-ai:mainfrom
songhanlin:main

Conversation

@songhanlin

@songhanlin songhanlin commented Mar 18, 2026 •

Copy link
Copy Markdown

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

  • What changed?
  • Why?

Testing

  • How did you test this change?
  • What did you verify manually?

Demo Video

For UI or behavior changes, include a short demo video (GitHub upload, Loom, or other direct link).

  • Video URL or attachment:

Review Trigger (Copy/Paste as PR comment)

@codex review
@coderabbitai review
@greptile-apps review
@cubic-dev-ai review

Checklist

  • I tested the change locally
  • I added or updated tests for behavior changes
  • I updated docs/changelog if needed
  • I requested bot reviews after my latest commit (copy/paste block above or equivalent)
  • All code review bot comments are resolved
  • All human review comments are resolved

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

  • New Features
    • Added "Equalize Splits" action accessible via keyboard (Cmd+Shift+E) and the command palette
    • Improved equalization to distribute pane space proportionally based on content weight
    • Added localized labels for "Equalize Splits" in multiple languages

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.
@vercel

vercel Bot commented Mar 18, 2026

Copy link
Copy Markdown

@songhanlin is attempting to deploy a commit to the Manaflow Team on Vercel.

A member of the Team first needs to authorize it.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai

coderabbitai Bot commented Mar 18, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fe3fe61b-299b-4ca5-8a5d-a18a94414b96

📥 Commits

Reviewing files that changed from the base of the PR and between 310364c and 7cfdd10.

📒 Files selected for processing (1)
  • Sources/TabManager.swift

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
Localization
Resources/Localizable.xcstrings
Added shortcut.equalizeSplits.label translations for multiple languages.
Keyboard Shortcuts
Sources/KeyboardShortcutSettings.swift
Added Action.equalizeSplits, localized label, defaults key, and default shortcut (Cmd+Shift+E).
Shortcut & Command Routing
Sources/AppDelegate.swift, Sources/ContentView.swift
Handle new equalizeSplits shortcut and palette.equalizeSplits command, routing to the tab manager.
Split Equalization Logic
Sources/TabManager.swift
Replaced fixed 0.5 divider with computed ratio; added weightForDirection(_:) helper and applied leaf-weighted divider positioning recursively.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐇 I nudged the dividers, soft and neat,
Counting leaves on every seat,
Not every split gets equal share—
I balance branches with rabbit care! 🌿

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description includes the template structure but the Testing, Demo Video, and Checklist sections are largely empty placeholders; core details about what changed and why are present in the summary and cubic comment. Complete the Testing section with actual test procedures and verification steps, provide a demo video URL, and check off or mark the relevant checklist items.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a keyboard shortcut (Cmd+Shift+E) for equalizing splits, which is the primary feature across all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 55cb5c6 and 310364c.

📒 Files selected for processing (5)
  • Resources/Localizable.xcstrings
  • Sources/AppDelegate.swift
  • Sources/ContentView.swift
  • Sources/KeyboardShortcutSettings.swift
  • Sources/TabManager.swift

Comment thread Sources/TabManager.swift
Add .lowercased() to both operands when comparing split orientation
strings to prevent mismatches from mixed-casing values.
@teamleaderleo teamleaderleo added S3: minor Wrong behavior with a workaround area: layout Splits, panes, tabs, windows, resizing, full screen labels Sep 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: layout Splits, panes, tabs, windows, resizing, full screen S3: minor Wrong behavior with a workaround

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants