summaryrefslogtreecommitdiff
path: root/core/layout.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-19 22:03:11 -0300
committerGabriel Schneider <[email protected]>2026-11-19 23:50:22 -0300
commita310585195484b8420f14cff3e736c604f47c11e (patch)
treeeaeea814f0c01731eb124bd115e1e8dac8d610b2 /core/layout.zig
parentb8a6b0589ddbe65a4c80272ff44ceb77d2f0d02f (diff)
downloadpardes-a310585195484b8420f14cff3e736c604f47c11e.tar.gz
pardes-a310585195484b8420f14cff3e736c604f47c11e.zip
core, docs, test: a pane that answers for another is docked to it, `Pane.docked_to`, and the tag word that lets it go is `Undock`, no longer `attached_to` and `Unattach` (P18 and P28, the user's rulings: *attach* is a client joining a session now; `Undock` confirmed; no alias, so `Unattach` is an unknown word after this change): the field `attached_to` on 24 lines of seven files (core/panes.zig's Pane field and its one use; views.zig's PaneView field and its name in `pane_fields`; dump.zig, Handover.zig, layout.zig, Query.zig, builtins.zig) and docs/next-daemon.md's mention; the builtin `Unattach` (its struct in core/builtins.zig with its help line and its refusal, "Undock: not docked to a pane"; its null key in core/config.zig; the frozen query pane's tag tail in core/tagline.zig with its comment; layout.zig's test that runs it; Query.zig's comment, with its two lines' "attached"/"unattached" where they mean docked); the builtin lists docs/typ/builtins-tui.json and builtins-gui.json (the line `zig build builtins-json` writes, checked byte for byte against the generator for both platforms); the one line in the changelog's Unreleased; docs/search-proto-converge.md's three mentions; the seven goldens that show a frozen query pane's tag (find, fsearch, grep, lookrange, lsp-client, lsprelpath, stepgrain: nine lines, each `Save Unattach Del` -> `Save Undock Del` and nothing else, edited by hand and passing as they are, not regenerated); the other prose "attach"/"attachment" meaning docked and the functions `attachFrom` and `testAttachment` stay (not ruled; listed in the report); a dump written before this change restores its docked panes undocked, with a note (walk.load lets an unknown field go); the semantics word does not move (38b5ae573b965550 before and after: the tape's shape names neither the builtin nor the field); tui core-test 848/991 (143 skipped), shell-test 1027/1030, pane-test 183/184, term-test 15/15, kitty-test 45/45, behaviour-test 275/275 (--replay 20 seeds, 0 failures), process-test 2 of 144 failed (lspcomplete and lspcompletemoved, the base's; msg's cursor column flaked once and passed again in the run), the soak (--clients 5) diverged 0, unequal 0, deltas wrong 0, quiet checks 618/0, 835/0, 771/0, stops unlisted 0, the corpus through a client 22 scenes each frame the same, no leak; gui unit-test 1625/1629 failing only the perf check's BaselineHarnessMismatch (as the base); the macOS library for Linux and aarch64-macos and the FreeBSD cross-build rc 0; the cheatsheet (one page), the book (77 pages) and the site build, Undock in the glossary; the frame and perf gate PASS (77/77 frames byte-identical in Debug, the alternated window corpus2x +0.041% against a 0.4% threshold, the 97 per-operation counts within 0.1%, the largest +0.0197%); under a load of 4 to 37
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/layout.zig')
-rw-r--r--core/layout.zig22
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" {