szn

Bug 284 — cmdRotateWindow rotates the pane list but not the layout tree

284. cmdRotateWindow rotates the pane list but not the layout tree

File: src/cmd/cmd.zig:652–662 Severity: HIGH Status: ✅ FIXED — cmdRotateWindow now delegates to Window.rotatePanes() so the layout tree rotates in lock-step with the panes list. Regression test verifies the layout’s left/right leaf panes swap to match the list.

const first = window.panes.items[0];
for (0..window.panes.items.len - 1) |i| {
    window.panes.items[i] = window.panes.items[i + 1];
}
window.panes.items[window.panes.items.len - 1] = first;

cmdRotateWindow hand-rolls list rotation and never calls window.rotatePanes() / layout.rotatePanes(). The layout tree (authoritative for rendering, findPaneBounds, directional neighbor) is left unchanged, so pane indices no longer match on-screen positions. select-pane, kill-pane, and swap-pane then target the wrong panes. The keybinding path (server.zig:792) correctly uses window.rotatePanes(), so the two entry points diverge.