summaryrefslogtreecommitdiff
path: root/src/Output.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 09:57:43 -0300
committerGabriel Schneider <[email protected]>2026-11-10 09:57:43 -0300
commita953f560f648e91dda8dd3a8dafe60a7f75739d0 (patch)
tree1ae6de86ede6b0e1464708c04478340609e4296e /src/Output.zig
parent5033138d9e93e05dc961c0f7b93e46208d5df33d (diff)
downloadpardes-a953f560f648e91dda8dd3a8dafe60a7f75739d0.tar.gz
pardes-a953f560f648e91dda8dd3a8dafe60a7f75739d0.zip
history: each dump is the command that brings it back, `Restore <label>` on a line of its own, its date, size, pane count and names indented on the line under it, so the line is a whole command (a sweep of it, a click on its Restore, a look at it) and the details are read, not parsed; the builtins JSON, the reference and the changelog say so
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.zig14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Output.zig b/src/Output.zig
index 1bf1b453..bb75e29f 100644
--- a/src/Output.zig
+++ b/src/Output.zig
@@ -570,10 +570,11 @@ 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, 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).
+/// The state file's dumps (Db.listDumps: label, date, size, pane count,
+/// the panes' names), the newest first, each as the command that brings
+/// it back, `Restore <label>` a line of its own, with its date, size and
+/// panes indented under it: a click on the Restore takes the label beside
+/// it (exec.operandAt), and a look at the line 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;
@@ -581,7 +582,10 @@ pub fn openHistory(p: *Pardes, id: usize) !void {
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});
+ while (rows.next()) |row| {
+ const label = row[0 .. std.mem.indexOfScalar(u8, row, ' ') orelse row.len];
+ try out.writer.print("Restore {s}\n {s}\n", .{ label, std.mem.trimStart(u8, row[label.len..], " ") });
+ }
try refillOrOpen(p, id, .{ .cmd = .History }, try out.toOwnedSlice());
}