diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 22:03:11 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-19 23:50:22 -0300 |
| commit | a310585195484b8420f14cff3e736c604f47c11e (patch) | |
| tree | eaeea814f0c01731eb124bd115e1e8dac8d610b2 /core | |
| parent | b8a6b0589ddbe65a4c80272ff44ceb77d2f0d02f (diff) | |
| download | pardes-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')
| -rw-r--r-- | core/CHANGELOG.md | 4 | ||||
| -rw-r--r-- | core/Handover.zig | 4 | ||||
| -rw-r--r-- | core/Query.zig | 14 | ||||
| -rw-r--r-- | core/builtins.zig | 8 | ||||
| -rw-r--r-- | core/config.zig | 2 | ||||
| -rw-r--r-- | core/dump.zig | 6 | ||||
| -rw-r--r-- | core/layout.zig | 22 | ||||
| -rw-r--r-- | core/panes.zig | 4 | ||||
| -rw-r--r-- | core/tagline.zig | 4 | ||||
| -rw-r--r-- | core/views.zig | 4 |
10 files changed, 38 insertions, 34 deletions
diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 1b28267e..5d15b974 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +- The tag word `Unattach` is `Undock`: a +Search docked under the pane it + answers for leaves it with `Undock`, and stays where it is, a pane of its + own. *Attach* is a client joining a session now; `Unattach` is an + unknown word, with no alias. - The row after a file's last newline, where the cursor can sit and no line is yet, shows `~` in the gutter where its line number was, as helix's does. diff --git a/core/Handover.zig b/core/Handover.zig index bcf42c31..dde31f8b 100644 --- a/core/Handover.zig +++ b/core/Handover.zig @@ -165,7 +165,7 @@ pub fn finish(h: *Handover, p: *Pardes, seq: u32, to: []const u8, failure: ?[]co const pane = p.panes[id].?; if (pane.file == null or pane.file.?.revision != revision) { // Out of its group, or the owner's close would take it along. - pane.attached_to = null; + pane.docked_to = null; kept += 1; continue; } @@ -277,7 +277,7 @@ pub fn adopt(p: *Pardes, bytes: []const u8) !usize { for (st.owners, 0..) |owner, k| { const at = owner orelse continue; if (at >= n) continue; - p.panes[slots[k]].?.attached_to = p.panes[slots[at]].?.serial; + p.panes[slots[k]].?.docked_to = p.panes[slots[at]].?.serial; } const tc = layout.targetColumn(p, x); var heights: [MAX_PANES]u16 = @splat(0); diff --git a/core/Query.zig b/core/Query.zig index b76a5aa4..0cecb93e 100644 --- a/core/Query.zig +++ b/core/Query.zig @@ -200,16 +200,16 @@ fn freeSaved(gpa: std.mem.Allocator, s: Saved) void { gpa.free(s.items); } -/// The owner's query pane (attached to it, or left where it was by -/// Unattach): the one a later search from it reuses. +/// The owner's query pane (docked to it, or left where it was by +/// Undock): the one a later search from it reuses. pub fn ofOwner(p: *Pardes, owner_serial: u32) ?usize { var found: ?usize = null; for (p.panes, 0..) |slot, i| { const pane = slot orelse continue; const q = pane.query orelse continue; if (q.owner != owner_serial) continue; - // the attached one first: an unattached one is a kept result - if (pane.attached_to == owner_serial) return i; + // the docked one first: an undocked one is a kept result + if (pane.docked_to == owner_serial) return i; found = found orelse i; } return found; @@ -1754,7 +1754,7 @@ fn promote(p: *Pardes, qid: usize, id: usize) void { // Its text was read from that file to preview it (displayPreview). f.on_disk = filesystem.localPath(f.path) != null; f.syntax_dirty = true; - pane.attached_to = null; + pane.docked_to = null; if (f.on_disk) p.recent.opened(p.recentGpa(), f.path); if (filesystem.localPath(f.path) != null) p.emit(.{ .watch = .{ .pane = .at(id), .on = true } }); pardes.ctlfs.events.noteLog(p, .rename, pane); @@ -1887,7 +1887,7 @@ pub fn cancel(p: *Pardes, id: usize) void { // A preview made for the query Esc took back has no use: its rows // go to the text whose rows they were. if (previewOf(p, id)) |pid| { - p.panes[pid].?.attached_to = null; + p.panes[pid].?.docked_to = null; p.removePane(pid, owner_id) catch |err| p.reportError(.at(id), "query", err); q.preview = 0; } @@ -2354,7 +2354,7 @@ test "Find: names fuzzy per keystroke, the group born with its +Preview, nothing try std.testing.expectEqual(pv, p.view().active); try std.testing.expectEqual(serial, p.panes[pv].?.serial); try std.testing.expect(p.panes[pv].?.file.?.output == null); - try std.testing.expect(p.panes[pv].?.attached_to == null); + try std.testing.expect(p.panes[pv].?.docked_to == null); layout.compute(p); try std.testing.expectEqualDeep(rect, p.view().rects[pv]); try std.testing.expect(q.frozen); diff --git a/core/builtins.zig b/core/builtins.zig index 1e0692a5..a7340352 100644 --- a/core/builtins.zig +++ b/core/builtins.zig @@ -1131,13 +1131,13 @@ pub const Collapse = struct { } }; -/// Unattach a pane from the pane it answers for: it stays where it is, a +/// Undock a pane from the pane it answers for: it stays where it is, a /// pane of its own, and the next search from that pane opens another /// under it. -pub const Unattach = struct { +pub const Undock = struct { pub fn run(c: Ctx) void { - if (c.pane.attached_to == null) return c.p.reportFailure(c.id, "Unattach: not attached to a pane"); - c.pane.attached_to = null; + if (c.pane.docked_to == null) return c.p.reportFailure(c.id, "Undock: not docked to a pane"); + c.pane.docked_to = null; } }; diff --git a/core/config.zig b/core/config.zig index e8b740d5..0032b03a 100644 --- a/core/config.zig +++ b/core/config.zig @@ -79,7 +79,7 @@ pub const leader_path = paths: { .Mode = null, .Togglettymode = null, .Collapse = null, - .Unattach = null, + .Undock = null, .Undo = null, .Edit = null, .Redo = null, diff --git a/core/dump.zig b/core/dump.zig index 35975a9b..a8dd170a 100644 --- a/core/dump.zig +++ b/core/dump.zig @@ -708,11 +708,11 @@ pub fn savePane(gpa: std.mem.Allocator, pane: *pardes.panes.Pane, slim: bool) ![ // The fields it changes put back after, not the whole pane (88 KB) kept // aside: a store record is made at every close. const cwd = pane.cwd; - const attached_to = pane.attached_to; + const docked_to = pane.docked_to; const terminal = pane.terminal; defer { pane.cwd = cwd; - pane.attached_to = attached_to; + pane.docked_to = docked_to; pane.terminal = terminal; } if (cwd == .inherited) { @@ -720,7 +720,7 @@ pub fn savePane(gpa: std.mem.Allocator, pane: *pardes.panes.Pane, slim: bool) ![ const dir = pane.cwdSlice(); pane.cwd = .{ .owned = @constCast(dir) }; } - pane.attached_to = null; + pane.docked_to = null; if (!slim) return walk.save(pardes.panes.Pane, gpa, pane); pane.terminal = null; const f = if (pane.file) |*file| file else return walk.save(pardes.panes.Pane, gpa, pane); 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" { diff --git a/core/panes.zig b/core/panes.zig index b928917a..72ca3eea 100644 --- a/core/panes.zig +++ b/core/panes.zig @@ -144,7 +144,7 @@ pub const Pane = struct { /// closes with it (layout.zig, "Attached panes"). An owner that is /// gone, or a pane no longer right under its owner's group, leaves it /// an ordinary pane (layout.keepGroups). - attached_to: ?u32 = null, + docked_to: ?u32 = null, /// This pane is a query pane: its line 1 the query, its rows made live /// from a source (Query.zig, gpa-owned). query: ?*Query = null, @@ -1437,7 +1437,7 @@ 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) { + for (0..p.panes.len) |k| if (p.panes[k]) |other| if (k != id and other.docked_to == pane.serial) { if (layout.ownerOf(p, k) != id) continue; try p.removePane(k, id); layout.compute(p); diff --git a/core/tagline.zig b/core/tagline.zig index 456a6b6e..fa25b2c1 100644 --- a/core/tagline.zig +++ b/core/tagline.zig @@ -35,9 +35,9 @@ pub const terminal_pane_tail = " " ++ config.terminal_pane_builtins_str; pub const command_pane_tail = " " ++ config.command_pane_builtins_str; pub const dir_pane_tail = " " ++ config.dir_pane_builtins_str; /// A query pane's while its rows are made (Query.zig), and once Enter froze -/// them into text a Save keeps; Unattach leaves it where it stands. +/// them into text a Save keeps; Undock leaves it where it stands. pub const query_live_tail = " Del"; -pub const query_frozen_tail = " Save Unattach Del"; +pub const query_frozen_tail = " Save Undock Del"; /// ...and while its Grep waits at 2000 lines for More (Stream.zig). pub const query_capped_tail = " More Del"; /// A file with changes it has not saved. diff --git a/core/views.zig b/core/views.zig index 9985288d..89dcb454 100644 --- a/core/views.zig +++ b/core/views.zig @@ -33,7 +33,7 @@ pub const max = 4; /// A pane's fields that are each view's own: where it is in the view's /// layout, which of its texts has the keyboard, how far it is scrolled, and /// what the view's step measured of it (its tag's rows, its bands). -const pane_fields = [_][:0]const u8{ "focus", "vweight", "collapsed", "attached_to", "hscroll", "tag_scroll", "tag_top", "tag_rows", "view", "notices", "pan", "follow_scroll" }; +const pane_fields = [_][:0]const u8{ "focus", "vweight", "collapsed", "docked_to", "hscroll", "tag_scroll", "tag_top", "tag_rows", "view", "notices", "pan", "follow_scroll" }; /// The body's: its cursor, selections and mode. Its undo stays the pane's. const body_fields = [_][:0]const u8{ "mode", "cur_pinned", "cur_row", "cur_col", "vsel", "sels", "nsel", "select", "sticky_col", "restore_cursor", "last_edit", "reg_wait", "normal", "find_op", "find_ch" }; @@ -43,7 +43,7 @@ pub const PaneView = struct { focus: Pane.Focus = .body, vweight: f32 = 1, collapsed: bool = false, - attached_to: ?u32 = null, + docked_to: ?u32 = null, hscroll: i32 = 0, tag_scroll: u16 = 0, tag_top: u16 = 0, |
