From c0b2e5d9194ce35b9fbb58d8d6e18de66cb209a8 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 10:46:54 -0300 Subject: store: Recent is a file of 200 lines under flock, written whole in place at the end of a step that changed it and read back under a session's own changes when another session wrote it since, and the panes a session closes are kept in its memory, the newest 64 within 64 MiB; the append-only CRC log with its resync and compaction, and the closed panes' self-describing dumps in it (only the session that closed one ever listed it), go; Options.store_path is recent_path ($XDG_STATE_HOME/pardes/recent), and the old store is read once while it is the newer of the two; tests: the store's four rewritten through the same windows (the 200 newest, a foreign file, a closed pane's way back from memory), the old store read once, 64 closed panes kept, recent.zig's merge; the process cases read Recent's file; docs/next-store.md is the decision Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/main.zig | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index 3dec406c..a7c0dcc0 100644 --- a/src/main.zig +++ b/src/main.zig @@ -777,7 +777,7 @@ fn nativeMain(std_init: std.process.Init) !void { opts.startup_config = found.bytes; opts.startup_config_path = found.path; opts.config_dir = found.dir; - opts.store_path = storePath(init.io, arena, init.environ_map); + opts.recent_path = recentPath(init.io, arena, init.environ_map); if (found.dir) |d| @import("crash.zig").setDir(d); if (attach) |name| if (std.mem.lastIndexOfScalar(u8, name, ':')) |colon| { remoteAttach(init, opts, name[0..colon], name[colon + 1 ..]); @@ -1136,11 +1136,11 @@ test { if (comptime pardes.font_picker) _ = @import("fonts.zig"); } -/// Where the store every window shares is kept (Store.zig): -/// $XDG_STATE_HOME/pardes/store, else ~/.local/state/pardes/store, the -/// directory made if need be; null with no home to keep it in (Recent and -/// the closed panes then last the session). -fn storePath(io: std.Io, arena: std.mem.Allocator, env: *const std.process.Environ.Map) ?[]const u8 { +/// Where Recent's file, which every session shares, is kept (Store.zig): +/// $XDG_STATE_HOME/pardes/recent, else ~/.local/state/pardes/recent, the +/// directory made if need be; null with no home to keep it in (Recent then +/// lasts the session). +fn recentPath(io: std.Io, arena: std.mem.Allocator, env: *const std.process.Environ.Map) ?[]const u8 { const dir = dir: { if (env.get("XDG_STATE_HOME")) |base| if (base.len != 0 and std.fs.path.isAbsolute(base)) break :dir std.fs.path.join(arena, &.{ base, "pardes" }) catch return null; @@ -1149,5 +1149,5 @@ fn storePath(io: std.Io, arena: std.mem.Allocator, env: *const std.process.Envir break :dir std.fs.path.join(arena, &.{ home, ".local", "state", "pardes" }) catch return null; }; std.Io.Dir.cwd().createDirPath(io, dir) catch return null; - return std.fs.path.join(arena, &.{ dir, "store" }) catch null; + return std.fs.path.join(arena, &.{ dir, "recent" }) catch null; } -- cgit v1.3