diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-10 09:57:43 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-10 09:57:43 -0300 |
| commit | a953f560f648e91dda8dd3a8dafe60a7f75739d0 (patch) | |
| tree | 1ae6de86ede6b0e1464708c04478340609e4296e /src | |
| parent | 5033138d9e93e05dc961c0f7b93e46208d5df33d (diff) | |
| download | pardes-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')
| -rw-r--r-- | src/CHANGELOG.md | 6 | ||||
| -rw-r--r-- | src/Output.zig | 14 | ||||
| -rw-r--r-- | src/builtins.zig | 7 | ||||
| -rw-r--r-- | src/exec.zig | 4 | ||||
| -rw-r--r-- | src/look.zig | 7 |
5 files changed, 23 insertions, 15 deletions
diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index 0531b4a0..fdc14c43 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -14,8 +14,10 @@ gone) leaves a slim dump in the state file: its panes with their files, directories and places, not a clean file's text, an undo history or a terminal's screen. `History` (`SPC f h`) lists the state file's dumps in a - `+History` pane, a row each: `Restore <label>` and the panes' names; a - click on a row's `Restore`, or a look at the row, is a `Restore` of it. `/dumps` rows end with the names too. The workspace row + `+History` pane, each as the command that brings it back, `Restore + <label>` on a line of its own with its date, size and the panes' names + indented under it; a click on that `Restore`, or a look at the line, is + that `Restore`. `/dumps` rows end with the names too. The workspace row has `History` before `Debug`, and a window's `Fonts` after `Themes`. - `Follow` is in a text pane's tag by default, after `Collapse`. 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()); } diff --git a/src/builtins.zig b/src/builtins.zig index 6214861d..85bb6e44 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1701,9 +1701,10 @@ pub const Recent = struct { }; /// List the state file's dumps, those Dump made and those every session's -/// end left (dump.dumpExit), the newest first: a row each, `Restore -/// <label>`, date, size, pane count and the panes' names; a click on a -/// row's Restore (an exec, or a look at the row) is a Restore of its label. +/// end left (dump.dumpExit), the newest first, each as the command that +/// brings it back, `Restore <label>` on a line of its own, its date, size, +/// pane count and the panes' names indented under it; a click on the +/// Restore (an exec, or a look at the line) is that Restore. pub const History = struct { pub const scope: Scope = .session; pub const output: OutputTraits = .{ .name = config.history_buffer }; diff --git a/src/exec.zig b/src/exec.zig index 06752ffd..df578d08 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -216,8 +216,8 @@ pub fn operandAt(p: *Pardes, pane: *Pane, clicked: Pane.Sel, borrow: bool, for_l if (source_col < word_from or word_from > line.len) return result; const word = look.expandedWord(line[word_from..], source_col - word_from) orelse return result; var b: look.ExpandedWord = .{ .lo = word.lo + word_from, .hi = word.hi + word_from }; - // A +History row's `Restore` is that row's: a click on it (an exec, - // or a look) takes the label beside it, as the row reads. + // A +History line's `Restore` is that line's: a click on it (an + // exec, or a look) takes the label beside it, as the line reads. if (look.isHistoryList(pane) and std.mem.eql(u8, line[b.lo..b.hi], "Restore")) { const rest = std.mem.trimStart(u8, line[b.hi..], " "); if (std.mem.startsWith(u8, rest, "pardes-")) b.hi = (line.len - rest.len) + (std.mem.indexOfAny(u8, rest, " \t") orelse rest.len); diff --git a/src/look.zig b/src/look.zig index 95506d9c..082565ed 100644 --- a/src/look.zig +++ b/src/look.zig @@ -1500,9 +1500,10 @@ pub fn lookAt(p: *Pardes, id: usize, operand_raw: []const u8) void { var home_buf: [4096]u8 = undefined; const stripped = std.mem.trim(u8, operand_raw, " \t\r\n"); const operand = if (stripped.len > 0 and stripped[0] == '~') filesystem.expandHome(stripped, &home_buf) else std.mem.trimEnd(u8, operand_raw, "\r\n"); - // A +History row names a dump of the state file's (`Restore <label>`, - // then its date, size and panes): a look at it is a Restore of that - // dump; its other words are looked as any (a path in it opens). + // A +History line names a dump of the state file's (`Restore <label>`; + // its date, size and panes are the indented line under it): a look at + // it is a Restore of that dump; other words are looked as any (a path + // in it opens). if (isHistoryList(pane)) { var row = std.mem.trim(u8, operand, " \t\r\n"); if (std.mem.startsWith(u8, row, "Restore ")) row = std.mem.trimStart(u8, row["Restore ".len..], " "); |
