Fix asymmetric equalize splits

Merged
AU
5mo ago
+143-82

Summary

  • add regression coverage for the asymmetric 3-pane equalize-splits layout
  • share the proportional leaf-count split equalizer between keyboard/menu/palette and RPC paths
  • preserve orientation-filtered RPC behavior while reporting failed divider writes

Fixes #4378.

Testing

  • Not run locally per task instructions (CI only).

[!NOTE]
Medium Risk
Changes split-divider equalization logic used by both UI commands and the RPC endpoint; incorrect leaf-count math or divider writes could leave layouts unbalanced, but the change is localized and covered by new regression tests.

Overview
Fixes equalize-splits for asymmetric layouts by introducing a shared SplitEqualizer that sets each split’s divider position based on leaf-pane proportions (optionally filtered by orientation) and reports whether all divider writes succeeded.

Switches both TabManager.equalizeSplits and the v2WorkspaceEqualizeSplits RPC to use SplitEqualizer, removes the prior inlined implementation and the delayed follow-up re-equalize passes, and updates tests to assert proportional (non-0.5) divider positions for a 3-pane asymmetric tree.

Reviewed by Cursor Bugbot for commit 5236e7c67a38cf20e1508a10d0565e76c5006e14. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Fixes #4378 by equalizing split trees using leaf-count proportions instead of 50/50, so asymmetric layouts distribute space correctly. A shared @MainActor SplitEqualizer now powers shortcuts and RPC, preserves orientation filtering, and sets RPC equalized to true only when all divider writes succeed.

  • Bug Fixes

    • Proportional divider positions; asymmetric 3-pane trees now equalize correctly.
    • Adds regression tests asserting proportional positions on asymmetric horizontal splits.
  • Refactors

    • Moves equalize logic into SplitEqualizer.swift (@MainActor).
    • Removes duplicate helpers from TerminalController and the delayed follow-up equalize reruns in TabManager.

Summary by CodeRabbit

  • New Features

    • Added a new equalization utility to compute and apply proportional pane sizing across splits.
  • Bug Fixes

    • Split equalization now distributes space proportionally based on pane counts instead of forcing 50/50 dividers.
  • Tests

    • Updated tests to validate proportional space distribution across nested split layouts.

Review Change Stack