summaryrefslogtreecommitdiff
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
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
-rw-r--r--docs/typ/builtins-gui.json2
-rw-r--r--docs/typ/builtins-tui.json2
-rw-r--r--docs/typ/reference.typ9
-rw-r--r--src/CHANGELOG.md6
-rw-r--r--src/Output.zig14
-rw-r--r--src/builtins.zig7
-rw-r--r--src/exec.zig4
-rw-r--r--src/look.zig7
-rw-r--r--test/behaviour/root_ctl.zig6
9 files changed, 33 insertions, 24 deletions
diff --git a/docs/typ/builtins-gui.json b/docs/typ/builtins-gui.json
index 7cb041c6..c7ff594f 100644
--- a/docs/typ/builtins-gui.json
+++ b/docs/typ/builtins-gui.json
@@ -45,7 +45,7 @@
{"name": "Grep", "leader": "SPC f g", "also": ["topbar"], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Find's sibling: Find matches file NAMES under this pane's directory, Grep matches the LINES of those files, on the disk engine's worker."},
{"name": "GripWidth", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "The grip and scrollbar width, as a percent of the theme's rail."},
{"name": "Help", "leader": "SPC ?", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Open the help: every key and every builtin."},
- {"name": "History", "leader": "SPC f h", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "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."},
+ {"name": "History", "leader": "SPC f h", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "List the state file's dumps, those Dump made and those every session's 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."},
{"name": "Hover", "leader": "SPC l k", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Ask the language server about the symbol under the cursor."},
{"name": "InactiveDim", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off."},
{"name": "Incl", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "acme's Incl, for the session: `Incl dir ...` adds directories a look at a name found nowhere else is tried in (`stdio.h`, `<foo.h>`), bare lists them, `Incl -` empties the list."},
diff --git a/docs/typ/builtins-tui.json b/docs/typ/builtins-tui.json
index b2812f58..feb1140f 100644
--- a/docs/typ/builtins-tui.json
+++ b/docs/typ/builtins-tui.json
@@ -41,7 +41,7 @@
{"name": "Get", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "acme's Get: the pane's file read again, its unsaved edits refused once as Del refuses them."},
{"name": "Grep", "leader": "SPC f g", "also": ["topbar"], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Find's sibling: Find matches file NAMES under this pane's directory, Grep matches the LINES of those files, on the disk engine's worker."},
{"name": "Help", "leader": "SPC ?", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Open the help: every key and every builtin."},
- {"name": "History", "leader": "SPC f h", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "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."},
+ {"name": "History", "leader": "SPC f h", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "List the state file's dumps, those Dump made and those every session's 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."},
{"name": "Hover", "leader": "SPC l k", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Ask the language server about the symbol under the cursor."},
{"name": "InactiveDim", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off."},
{"name": "Incl", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "acme's Incl, for the session: `Incl dir ...` adds directories a look at a name found nowhere else is tried in (`stdio.h`, `<foo.h>`), bare lists them, `Incl -` empties the list."},
diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ
index 04a207e0..030b7c6a 100644
--- a/docs/typ/reference.typ
+++ b/docs/typ/reference.typ
@@ -402,10 +402,11 @@ Writes take settings and session builtins (`scope = .session` in
file's, read again), an undo history or a terminal's screen (a new shell
starts in the directory); a session of shells alone leaves none.
#word("History") (`SPC f h`) lists the state file's dumps in a `+History`
- pane, the newest first, a row each: `Restore <label>`, its date, size,
- pane count and what its panes showed, a word each; a click on a row's
- #word("Restore") (its exec, or a look at the row) is a #word("Restore") of
- that dump. `Dump export <path>` writes the dump to a file of its own
+ pane, the newest first, each as the command that brings it back,
+ `Restore <label>` on a line of its own, with its date, size, pane count
+ and what its panes showed, a word each, indented under it; a click on
+ that #word("Restore") (its exec, or a look at the line) is that
+ #word("Restore"). `Dump export <path>` writes the dump to a file of its own
instead (`~` the home directory; the tag's word then names the path), which
`-l <path>` and #word("Restore") `<path>` read: the way to carry a session to
another machine.
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..], " ");
diff --git a/test/behaviour/root_ctl.zig b/test/behaviour/root_ctl.zig
index a3379685..7cb12a66 100644
--- a/test/behaviour/root_ctl.zig
+++ b/test/behaviour/root_ctl.zig
@@ -264,7 +264,7 @@ test "root-ctl: a Dump killed in the middle leaves the one before it whole, and
try std.testing.expectEqual(@as(usize, 2), (try labels(&s)).len);
}
-test "root-ctl: a session's end leaves a slim dump the next session's History lists as `Restore <label>` with the panes' names, a middle click on the Restore or a look at the row restores the file pane, and a session of shells alone leaves none" {
+test "root-ctl: a session's end leaves a slim dump the next session's History lists as a `Restore <label>` line over its details, a middle click on the Restore or a look at the line restores the file pane, and a session of shells alone leaves none" {
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
var dir_buf: [std.fs.max_path_bytes]u8 = undefined;
@@ -294,7 +294,7 @@ test "root-ctl: a session's end leaves a slim dump the next session's History li
try s.write("/exec", "History\n");
const hist = std.mem.trimEnd(u8, try s.read("/exec"), "\n");
const body = try s.read(s.at("/pane/{s}/body", .{hist}));
- try std.testing.expect(std.mem.startsWith(u8, body, s.at("Restore {s} ", .{listed[0]})));
+ try std.testing.expect(std.mem.startsWith(u8, body, s.at("Restore {s}\n ", .{listed[0]})));
try std.testing.expect(has(body, "a.txt"));
// A middle click on the row's Restore: that row's dump restored, the
// file pane back with its text; a bare Restore would have been this
@@ -302,7 +302,7 @@ test "root-ctl: a session's end leaves a slim dump the next session's History li
try s.click(s.at("Restore {s}", .{listed[0]}), 2, 2);
try std.testing.expect(has(try s.read("/log"), s.at("restore {s}\n", .{listed[0]})));
try s.expect(s.at("/pane/{d}/body", .{try s.lookFile(s.at("{s}/a.txt", .{dir}))}), "kept on disk\n");
- // A look at the whole row is the same Restore.
+ // A look at the whole line is the same Restore.
try s.write("/exec", "History\n");
const again = std.mem.trimEnd(u8, try s.read("/exec"), "\n");
const row = try s.read(s.at("/pane/{s}/body", .{again}));