diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 12:14:13 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | ab220b89afcfda848cf84c18cc135a2e5c392b79 (patch) | |
| tree | 7fd2e82e88d0dd86aa3b2dc2a8146643fcacd9de /src/recent.zig | |
| parent | c30835e62d3b7dd03ee8b28fbcff97d3b88bcd95 (diff) | |
| download | pardes-ab220b89afcfda848cf84c18cc135a2e5c392b79.tar.gz pardes-ab220b89afcfda848cf84c18cc135a2e5c392b79.zip | |
Recent goes on across a Restore, and is kept after it
A Restore makes a new session, which never loaded the kept list, and saveRecent gives up until it has: Recent was empty after a Restore and nothing opened afterwards was kept. The new session now takes the old one's list (a boot from a dump reads the kept file).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/recent.zig')
| -rw-r--r-- | src/recent.zig | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/recent.zig b/src/recent.zig index 91c0afeb..112cb59f 100644 --- a/src/recent.zig +++ b/src/recent.zig @@ -83,6 +83,23 @@ pub const List = struct { l.dirty = true; } + /// A copy, for the session a Restore makes: its files closed until it + /// opens them again. Out of memory, what was copied so far. + pub fn clone(l: *const List, gpa: std.mem.Allocator) List { + var copy: List = .{ .dirty = true }; + for (l.entries.items) |e| { + const path = gpa.dupe(u8, e.path) catch break; + var kept = e; + kept.path = path; + kept.open = false; + copy.entries.append(gpa, kept) catch { + gpa.free(path); + break; + }; + } + return copy; + } + pub fn get(l: *const List, path: []const u8) ?Entry { return l.entries.items[l.find(path) orelse return null]; } |
