From 7e7d9569a008124cb7ea01b6720a8d5963b0a42f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 24 Nov 2026 18:54:18 -0300 Subject: walk (pick-ui SPEC §2, §6.1, §6.5, item 1 of the Walk UI line B): a pane is held or reading: Pane.trail (core/Trail.zig: a fixed walk, max_steps 16 of max_text 256 bytes, its steps a union of place, owner, list, search and recipe, `cur` held by walk.zig, in the digest and the dumps) and `held`, set by Keep (a new builtin, `SPC j k`) and by any edit of the file (File.edit, Trail.edited, twins too); a reading pane (a file not held: no output, listing, pager, query or kind) shows Keep after its path in its tag and its tag in the reading tint (a new theme role tag_reading_bg, derived from the page and the search ground, acme the spec's #f3f0cc), under the new setting `Jumps walk|new-pane`, whose default is new-pane until the walk's pickers are in, so every tag, frame and golden is as before (a walk default changes 74 of 102 process goldens and 21 behaviour tests by the Keep word alone); TEST FIRST: Trail.zig "a file's pane is reading ..." and "Keep holds a reading pane ..."; draw.zig's three-row tag test reads its band through tagGround; docs/typ/builtins-tui.json refreshed; core-test 993/1159 (166 skipped), pane-test 183/184, behaviour-test 277/277 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- core/panes.zig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core/panes.zig') diff --git a/core/panes.zig b/core/panes.zig index 8939bd05..c11fdc94 100644 --- a/core/panes.zig +++ b/core/panes.zig @@ -15,6 +15,7 @@ const dump = @import("dump.zig"); const memory = @import("memory.zig"); const ctlfs = @import("ninep/tree.zig"); const Pipe = @import("Pipe.zig"); +const Trail = @import("Trail.zig"); const Key = pardes.Key; const Cell = pardes.Cell; const BOX_H = pardes.BOX_H; @@ -269,6 +270,9 @@ pub const Pane = struct { /// the current one selected (Places.zig). places: Places = .{}, look_at: ?LookSpot = null, + /// Its walk: the places it stepped through, its owner when it is a + /// reader, whether it is held (Trail.zig, pick-ui SPEC §6). + trail: Trail = .{}, /// `gw`'s words, labelled in order while it waits for a label to be /// typed (gpa-owned); `jump_first` is the label's first letter once typed. jump: std.ArrayList(modal.Selection) = .empty, -- cgit v1.3 From 9f63733156853c925c31a948b50d4a3a7b77aa70 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 24 Nov 2026 19:34:57 -0300 Subject: walk (pick-ui SPEC §6.5, §11, item 5 of the Walk UI line B): a held pane's reader is its tether and closes with it (panes.removePane: Trail.readerOf first, its rows where a closed pane's go), one kept or typed into stays; Keep (the tag word, `SPC j k`, item 1) and an edit hold a reader the same way, its places, owner and forward steps leaving its tag and a search's or a recipe's word staying, so the next jump from its old owner makes a new reader; TEST FIRST: Trail.zig "closing a held pane closes its reader; a kept reader stays; typed into, a reader is held and its walk leaves its tag" (Keep itself in the §6.7 session test); core-test 1000/1166 (166 skipped), pane-test 183/184, behaviour-test 277/277 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- core/Trail.zig | 29 +++++++++++++++++++++++++++++ core/panes.zig | 3 +++ 2 files changed, 32 insertions(+) (limited to 'core/panes.zig') diff --git a/core/Trail.zig b/core/Trail.zig index 3faccafa..7166d810 100644 --- a/core/Trail.zig +++ b/core/Trail.zig @@ -631,3 +631,32 @@ test "Ctrl-o goes back one place in a reader's walk and Ctrl-i forward again; pa try std.testing.expect(!walkBy(p, p.view().active, -1)); try std.testing.expect(!walkBy(p, f.held, -1)); } + +test "closing a held pane closes its reader; a kept reader stays; typed into, a reader is held and its walk leaves its tag" { + var f: Fixture = .{ .p = undefined, .tmp = undefined }; + try f.init(60); + defer f.deinit(); + const p = f.p; + const owner = p.panes[f.held].?.serial; + var buf: [4096 + 128]u8 = undefined; + f.look(f.held, "rank.zig", 12); + f.look(p.view().active, "place.zig", 8); + const r = p.view().active; + // Typed into: held, its walk gone from its tag, kept when its owner goes. + typeKeys(p, "ix"); + p.update(.{ .key = .{ .cp = pardes.Key.escape } }); + p.sync(); + try std.testing.expect(std.mem.startsWith(u8, try tagOf(p, p.panes[r].?), try std.fmt.bufPrint(&buf, "{s}/place.zig Save", .{f.dir}))); + try std.testing.expectEqual(@as(u8, 0), p.panes[r].?.trail.n); + // The next jump from its old owner makes a new reader. + f.look(f.held, "rank.zig", 30); + const fresh = p.view().active; + try std.testing.expect(fresh != r); + try std.testing.expectEqual(owner, p.panes[fresh].?.trail.steps[0].owner); + // Del of the owner: its reader goes with it; the edited one stays. + const fresh_serial = p.panes[fresh].?.serial; + try p.removePane(f.held, null); + p.sync(); + try std.testing.expect(p.paneBySerial(fresh_serial) == null); + try std.testing.expect(p.panes[r] != null); +} diff --git a/core/panes.zig b/core/panes.zig index c11fdc94..1a27b238 100644 --- a/core/panes.zig +++ b/core/panes.zig @@ -1510,6 +1510,9 @@ pub fn removePane(p: *Pardes, id: usize, to: ?usize) error{OutOfMemory}!void { try p.removePane(k, id); layout.compute(p); }; + // A held pane's reader is its tether: it closes with it (pick-ui + // SPEC §11), its rows going where a closed pane's go. + if (Trail.readerOf(p, pane)) |r| try p.removePane(r, null); // A docked pane's rows go back to its owner and nobody else. const owner = layout.ownerOf(p, id); const place = layout.findPane(p, id); -- cgit v1.3