diff options
Diffstat (limited to 'core/layout.zig')
| -rw-r--r-- | core/layout.zig | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/core/layout.zig b/core/layout.zig index 6ce0845f..9c99dc7d 100644 --- a/core/layout.zig +++ b/core/layout.zig @@ -339,7 +339,7 @@ pub fn movePane(p: *Pardes, id: usize, cur_x: u16, cur_y: u16) void { for (moved[0..count], 0..) |m, j| insert(p, placement.preview_col, j, m); if (count > 1) setColumnWeights(p, placement.preview_col, &heights); if (source_multi) setColumnWeights(p, src.col, &heights); - if (owner != null) p.panes[id].?.attached_to = null; + if (owner != null) p.panes[id].?.docked_to = null; return; }; const af = findPane(p, above) orelse return; @@ -367,7 +367,7 @@ pub fn movePane(p: *Pardes, id: usize, cur_x: u16, cur_y: u16) void { const pane = p.panes[id].?; // Still right under its owner's group: resized there. Anywhere // else it is a pane of its own. - if (af.col != (findPane(p, o) orelse return).col or !descends(p, above, o)) pane.attached_to = null; + if (af.col != (findPane(p, o) orelse return).col or !descends(p, above, o)) pane.docked_to = null; } } @@ -1115,7 +1115,7 @@ pub fn splitBelow(p: *Pardes, src_id: usize, nw: *Pane) void { // ---- Attached panes ---- // // A results pane (+Search, +Callstack, +Diff, +Errors) is ATTACHED to the -// pane it answers for, its owner (Pane.attached_to). The owner and what is +// pane it answers for, its owner (Pane.docked_to). The owner and what is // attached to it, and what is attached to those (a preview under a // +Search), are a GROUP: contiguous in one column, the owner first. A group // is one place to everything else in the layout: an unrelated pane is never @@ -1126,7 +1126,7 @@ pub fn splitBelow(p: *Pardes, src_id: usize, nw: *Pane) void { /// The slot of `id`'s owner, when `id` is attached to a live pane. pub fn ownerOf(p: *const Pardes, id: usize) ?usize { - const serial = (p.panes[id] orelse return null).attached_to orelse return null; + const serial = (p.panes[id] orelse return null).docked_to orelse return null; for (p.panes, 0..) |slot, i| if (slot) |pane| if (pane.serial == serial and i != id) return i; return null; } @@ -1168,10 +1168,10 @@ pub fn groupEnd(p: *const Pardes, c: usize, idx: usize) usize { pub fn keepGroups(p: *Pardes) void { for (0..p.view().ncol) |c| for (p.view().cols[c].panes[0..p.view().cols[c].n], 0..) |id, k| { const pane = p.panes[id] orelse continue; - if (pane.attached_to == null) continue; + if (pane.docked_to == null) continue; const kept = if (ownerOf(p, id)) |owner| k > 0 and descends(p, p.view().cols[c].panes[k - 1], owner) else false; if (kept) continue; - pane.attached_to = null; + pane.docked_to = null; }; } @@ -1206,7 +1206,7 @@ pub fn attachFrom(p: *Pardes, owner: usize, id: usize, rows: u16, giver: usize) insert(p, f.col, groupEnd(p, f.col, f.idx), id); g.vweight = @floatFromInt(oh - give); nw.vweight = @floatFromInt(give); - nw.attached_to = o.serial; + nw.docked_to = o.serial; compute(p); return true; } @@ -1991,9 +1991,9 @@ test "an attachment survives Dump and Restore, and one left away from its owner const restored = try dump.initFromDump(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 40 }, p.dump_out.?); defer restored.deinit(); try std.testing.expectEqual(@as(?usize, 0), ownerOf(restored, s)); - // Unattach: a pane of its own where it stands. - pardes.exec.runBuiltin(p, .Unattach, s, "", null); - try std.testing.expect(p.panes[s].?.attached_to == null); + // Undock: a pane of its own where it stands. + pardes.exec.runBuiltin(p, .Undock, s, "", null); + try std.testing.expect(p.panes[s].?.docked_to == null); // Put above its owner by a route that does not carry groups: detached. const t = try testAttachment(p); try std.testing.expect(attachFrom(p, 0, t, 8, 0)); @@ -2001,7 +2001,7 @@ test "an attachment survives Dump and Restore, and one left away from its owner removePane(p, t); insert(p, 0, 0, t); compute(p); - try std.testing.expect(p.panes[t].?.attached_to == null); + try std.testing.expect(p.panes[t].?.docked_to == null); } test "a new column takes width only from the column that created it" { |
