summaryrefslogtreecommitdiff
path: root/src/Output.zig
diff options
context:
space:
mode:
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());
}