summaryrefslogtreecommitdiff
path: root/src/Output.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Output.zig')
-rw-r--r--src/Output.zig17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Output.zig b/src/Output.zig
index 0161878e..a38245c7 100644
--- a/src/Output.zig
+++ b/src/Output.zig
@@ -570,6 +570,23 @@ pub fn openJumps(p: *Pardes, id: usize) !void {
try refillOrOpen(p, id, .{ .cmd = .Jumplist }, try out.toOwnedSlice());
}
+/// 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.
+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));
+}
+
+/// Db.listDumps's text, the step's (scratch); null for no state file.
+fn dumpsText(p: *Pardes) ?[]const u8 {
+ var out: std.Io.Writer.Allocating = .init(p.scratch.allocator());
+ p.db.listDumps(p, &out.writer) catch return null;
+ return out.written();
+}
+
/// The recent list as rows: `<path>:<line>:<col> open|closed`, most recent
/// first; a look at a row opens the file there, as a +Jumps row does.
pub fn recentText(p: *Pardes, w: *std.Io.Writer, look_rows: bool) !void {