summaryrefslogtreecommitdiff
path: root/src/look.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-09 23:15:39 -0300
committerGabriel Schneider <[email protected]>2026-11-09 23:15:53 -0300
commit0b4cfd4b416d03ef64ccd908dfee810c6a498569 (patch)
tree83da4851e30b4dd0e788b66f0024d5b55eaee421 /src/look.zig
parent7e6fc8c9f62bc3dc08e24856cc647fa0adefb32c (diff)
downloadpardes-0b4cfd4b416d03ef64ccd908dfee810c6a498569.tar.gz
pardes-0b4cfd4b416d03ef64ccd908dfee810c6a498569.zip
a session's end leaves a slim dump and History lists them, the tags gain Follow, History and the window's Fonts: every way out (Exit, the last pane's Del, the host's quit) runs Pardes.endSession, which puts a dump of the session in the state file under the usual label before quitting, slim by the dump's own means (dumpJoin's slim_terminals, and Store's slim-file swap now a Slim struct: no undo, a clean file's text read from its file again by revivePane, a terminal a size for a new shell), none for a session of shells alone; the dump's image carries the panes' names, which /dumps rows end with; the History builtin (SPC f h) lists the state file's dumps in a +History pane and a look at a row is a Restore of its label; the default tags: Follow after Collapse on text panes, History before Debug on the workspace row, Fonts after Themes in a window's view alone (tagline.topbarDefault picks the row per view; both rows are known defaults to the docs and tutor tests); the tty goldens re-recorded (the new words; a narrow pane's tag wraps to a second row, so its body rows shift), builtins JSON regenerated
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/look.zig')
-rw-r--r--src/look.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/look.zig b/src/look.zig
index bde63bf3..be102339 100644
--- a/src/look.zig
+++ b/src/look.zig
@@ -1359,6 +1359,13 @@ fn isRecentList(pane: *const Pane) bool {
return std.meta.eql(o.from, panes.Output.Origin{ .cmd = .Jumplist });
}
+/// Whether `pane` is the History list, whose rows name dumps.
+fn isHistoryList(pane: *const Pane) bool {
+ const f = pane.file orelse return false;
+ const o = f.output orelse return false;
+ return std.meta.eql(o.from, panes.Output.Origin{ .cmd = .History });
+}
+
// ---- a look on a diff line ----
/// The lines of a pane showing a diff, a .diff or .patch file or a
@@ -1493,6 +1500,14 @@ 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 (its label, first):
+ // a look at it is a Restore of that dump; its other words are looked
+ // as any (a path in it opens).
+ if (isHistoryList(pane)) {
+ const row = std.mem.trim(u8, operand, " \t\r\n");
+ const label = row[0 .. std.mem.indexOfAny(u8, row, " \t") orelse row.len];
+ if (std.mem.startsWith(u8, label, "pardes-")) return exec.runBuiltin(p, .Restore, id, "Restore", label);
+ }
// A +Recent row is a remembered place: reopened and clamped to the file
// as it is now, never a miss for a line the file no longer has.
if (isRecentList(pane)) {