summaryrefslogtreecommitdiff
path: root/src/Output.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 09:22:10 -0300
committerGabriel Schneider <[email protected]>2026-11-10 09:29:11 -0300
commite617ee11b6fafd48278ef0e371fa1981f8559413 (patch)
tree106b973366d1905e38b009b8b5b1d3005b8eb4ba /src/Output.zig
parent3eb166e287ec5afbd54b03a86711610e1b5269b6 (diff)
downloadpardes-e617ee11b6fafd48278ef0e371fa1981f8559413.tar.gz
pardes-e617ee11b6fafd48278ef0e371fa1981f8559413.zip
history: a +History row reads `Restore <label>` before its date, size and panes, and a click on that Restore (an exec, or a look) is a Restore of that row's dump, exec.operandAt expanding the word to the label beside it as the row reads, where a bare Restore would have been this session's last dump; a look of the whole row reads past the word; the behaviour test clicks a row's Restore and looks at a row
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/Output.zig')
-rw-r--r--src/Output.zig13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Output.zig b/src/Output.zig
index c76e31b1..1bf1b453 100644
--- a/src/Output.zig
+++ b/src/Output.zig
@@ -571,13 +571,18 @@ pub fn openJumps(p: *Pardes, id: usize) !void {
}
/// The state file's dumps as rows (Db.listDumps: label, date, size, pane
-/// count, the panes' names), the newest first; a look at a row is a
-/// Restore of its label (look.zig). Asked of the authority: the state file
-/// is its host's.
+/// count, the panes' names), the newest first, each behind the `Restore`
+/// that brings it back: an exec of a row's Restore takes the label beside
+/// it (exec.operandAt), and a look at the row is the same (look.zig).
+/// Asked of the authority: the state file is its host's.
pub fn openHistory(p: *Pardes, id: usize) !void {
const text = pardes.tape.authority(dumpsText, .{p}) orelse return error.NoStateFile;
if (text.len == 0) return error.NoDumps;
- try refillOrOpen(p, id, .{ .cmd = .History }, try p.gpa.dupe(u8, text));
+ var out: std.Io.Writer.Allocating = .init(p.gpa);
+ errdefer out.deinit();
+ var rows = std.mem.splitScalar(u8, std.mem.trimEnd(u8, text, "\n"), '\n');
+ while (rows.next()) |row| try out.writer.print("Restore {s}\n", .{row});
+ try refillOrOpen(p, id, .{ .cmd = .History }, try out.toOwnedSlice());
}
/// Db.listDumps's text, the step's (scratch); null for no state file.