summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-24 10:05:01 -0300
committerGabriel Schneider <[email protected]>2026-10-24 10:14:38 -0300
commit873f81ccb1449119846de8d4e6e0e8899236100a (patch)
tree66ad8ca2e913e4a954be947c54aa0b31a0c9fdb0 /src/pardes.zig
parent19c83c90ebed4817acd7a12d4d225f5af0957bc1 (diff)
downloadpardes-873f81ccb1449119846de8d4e6e0e8899236100a.tar.gz
pardes-873f81ccb1449119846de8d4e6e0e8899236100a.zip
Search converge 1/6: attached panes, a pane under its owner on the owner's rows alone, fixed height, moving, folding and closing with it
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 80ff3495..c58452ee 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -7146,13 +7146,22 @@ pub const Pardes = struct {
/// closing ends the session. Every route that closes a pane comes
/// through here or removeColumn, so none picks focus for itself, and
/// none by recency.
- pub fn removePane(p: *Pardes, id: usize, to: ?usize) !void {
+ pub fn removePane(p: *Pardes, id: usize, to: ?usize) error{OutOfMemory}!void {
const pane = p.panes[id] orelse return;
+ // What is attached to it closes with it, first, each giving its rows
+ // back to it: then its rows, theirs among them, go where a pane's go.
+ for (0..p.panes.len) |k| if (p.panes[k]) |other| if (k != id and other.attached_to == pane.serial) {
+ if (layout.ownerOf(p, k) != id) continue;
+ try p.removePane(k, id);
+ layout.compute(p);
+ };
+ // An attachment's rows go back to its owner and nobody else.
+ const owner = layout.ownerOf(p, id);
const place = layout.findPane(p, id);
const emptied = if (place) |f| (if (p.col_n[f.col] == 1) f.col else null) else null;
// Before anything is torn down, so a failure here changes nothing.
try p.deinitPane(pane);
- const gainer = layout.absorbVWeight(p, id, to);
+ const gainer = layout.absorbVWeight(p, id, owner orelse to);
const beside = if (emptied) |c| p.besideColumn(c, p.rects[id]) else null;
layout.removePane(p, id);
p.panes[id] = null;