diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-10 09:22:10 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-10 09:29:11 -0300 |
| commit | e617ee11b6fafd48278ef0e371fa1981f8559413 (patch) | |
| tree | 106b973366d1905e38b009b8b5b1d3005b8eb4ba /src/look.zig | |
| parent | 3eb166e287ec5afbd54b03a86711610e1b5269b6 (diff) | |
| download | pardes-e617ee11b6fafd48278ef0e371fa1981f8559413.tar.gz pardes-e617ee11b6fafd48278ef0e371fa1981f8559413.zip | |
history: a +History row reads `Restore <label>` before its date, size and panes, and a click on that Restore (an exec, or a look) is a Restore of that row's dump, exec.operandAt expanding the word to the label beside it as the row reads, where a bare Restore would have been this session's last dump; a look of the whole row reads past the word; the behaviour test clicks a row's Restore and looks at a row
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.zig | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/look.zig b/src/look.zig index 6ecebd41..95506d9c 100644 --- a/src/look.zig +++ b/src/look.zig @@ -1360,7 +1360,7 @@ fn isRecentList(pane: *const Pane) bool { } /// Whether `pane` is the History list, whose rows name dumps. -fn isHistoryList(pane: *const Pane) bool { +pub 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 }); @@ -1500,11 +1500,12 @@ 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). + // 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). if (isHistoryList(pane)) { - const row = std.mem.trim(u8, operand, " \t\r\n"); + 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..], " "); 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); } |
