Investigate split window blank (#3386)

Closed
AU
2mo ago
+357-13

Closes #3386

Summary

  • Centralizes terminal split creation and placeholder repair through shared lifecycle helpers in Workspace so every new terminal split publishes the split event and immediately schedules the event-driven layout follow-up with geometry and focus.
  • Keeps surface.split_off from emptying a source pane by preserving the single-tab guard and returning invalid_state for that API case.
  • Adds split-render regression coverage for both v1 and v2 socket tests, plus Swift unit coverage for the surface.split_off source-pane invariant.

Testing

  • Not run locally per repo policy and user instruction.
  • CI covers the Swift unit regression in cmuxTests/TerminalControllerSurfaceSplitOffTests.swift.
  • CI covers the split-render regression through tests/test_split_flash_and_layout.py and tests_v2/test_split_flash_and_layout.py, using tests/split_render_helpers.py to verify the newly created split panel visibly renders deterministic terminal output.

Notes

  • This branch was merged with current main before the final CI pass so required checks evaluate the up-to-date integration state.
  • Demo video omitted; the regression is covered by the CI-rendered split panel assertions.

[!NOTE]
Medium Risk
Touches terminal split/placeholder-repair lifecycle and layout follow-up scheduling, which can impact focus and geometry timing during splits; regressions would show up as blank/incorrectly sized panes.

Overview
Centralizes terminal split creation/repair through new Workspace helpers (beginTerminalSplitPaneLifecycle, beginTerminalSplitSurfaceLifecycle, commitNewTerminalSplitPane) so every new terminal pane/surface consistently publishes cmux events and immediately triggers event-driven layout follow-up with geometry (and optional focus).

Updates placeholder-repair and UI/programmatic split paths to use the shared lifecycle and ensures layout follow-up runs after creating replacement terminals (reducing split “blank/flash” states).

Adds regression coverage: a Swift unit test ensuring surface.split_off rejects splitting the only tab in a pane (invalid_state), plus shared Python helpers and enhanced v1/v2 split layout tests that assert newly split terminals actually render output.

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

Summary by CodeRabbit

  • Tests

    • Added test helpers for validating terminal split rendering output.
    • Added test coverage for surface.split_off API validation on terminal panes.
  • Refactor

    • Consolidated terminal split lifecycle management with centralized helper methods.

Review Change Stack