szn

Bug 220 — Pane swap (swap_pane_up/swap_pane_down) does not resize panes to their new positions

220. Pane swap (swap_pane_up/swap_pane_down) does not resize panes to their new positions

File: src/server/server.zig:849–870 Severity: HIGH Status: ✅ FIXED — added resizePaneToNode helper and layoutFindNodeBounds to compute dimensions from the layout tree; both swap directions call it after swapping.

const node1 = window.layout.findLeafParent(window.layout.root, pane) orelse return;
const node2 = window.layout.findLeafParent(window.layout.root, dest_pane) orelse return;
node1.leaf = dest_pane;
node2.leaf = pane;
window.panes.items[active_idx] = dest_pane;
window.panes.items[dest_idx] = pane;

Swapping panes only exchanges the *Pane pointers in the layout tree leaf nodes. Each pane’s screen.grid retains its original dimensions from its previous position. If pane A occupies a 80×12 slot and pane B occupies 80×11, after the swap pane A’s grid is still 80×12 (in the 80×11 slot) and pane B’s is still 80×11 (in the 80×12 slot). Neither pane is resized to its new slot until the next SIGWINCH or manual resize triggers Window.resize.

Fix: After swapping the leaf pointers, call pane.resizeTerminal(new_width, new_height) for both panes using their new slot dimensions.