From 93862a52fd695014969a272b04f442e512211a97 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sat, 24 Oct 2026 14:10:14 -0300 Subject: Store 3/3: Recent and Panes in the guide and reference, the changelog, an unhosted core's flush returning before any host call, the design note as built with its numbers and positions --- src/CHANGELOG.md | 8 ++++++++ src/Store.zig | 21 +++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index c2e0f3f7..fc8ede3b 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -11,6 +11,14 @@ have passed with no answer: SPC d j typed straight on closes the pane without the band flashing, and a hand that stops after SPC d gets it as a hint. +- One store every window shares, `$XDG_STATE_HOME/pardes/store` (100 MiB + at most, the oldest falling off): Recent is every window's files, read + again when it is used, where each window used to overwrite the others' + list in `recent` (read once into the store, then left alone). Panes lists + this session's closed panes after the open ones, `(closed)`: Enter, or a + Look at its `@pN`, brings one back beside the pane that took its rows, + as it was (a scratch's text, a terminal's history above a new shell, an + unsaved file's text). - Callstack (gc or Space l b) opens a readable static call hierarchy with outermost callers first, tree-sitter signatures, depth guides and clickable call sites. `gc` replaces the old move-to-viewport-center binding. diff --git a/src/Store.zig b/src/Store.zig index 35033e04..e06c55e5 100644 --- a/src/Store.zig +++ b/src/Store.zig @@ -599,16 +599,10 @@ pub fn close(s: *Store, p: *Pardes, k: Kept, gainer: ?usize) void { pub fn flush(s: *Store, p: *Pardes, wait: bool) void { const gpa = p.recentGpa(); if (!p.recent.dirty and s.pending.items.len == 0) return; - const path = if (comptime pardes.hosted) s.path else null; - if (path == null or !s.loaded) { - if (path == null) { - for (p.recent.entries.items) |*e| e.changed = false; - p.recent.dirty = false; - s.pending.clearRetainingCapacity(); - for (s.closed.items) |*c| c.pending_at = null; - } - return; - } + // No file: nothing to write it to, ever. + if (comptime !pardes.hosted) return s.forget(p); + const path: ?[]const u8 = s.path orelse return s.forget(p); + if (!s.loaded) return; const io = ioOf(); var name_buf: [4096 + 16]u8 = undefined; const lock_path = std.fmt.bufPrint(&name_buf, "{s}.lock", .{path.?}) catch return; @@ -658,6 +652,13 @@ pub fn flush(s: *Store, p: *Pardes, wait: bool) void { s.pending.clearRetainingCapacity(); } +fn forget(s: *Store, p: *Pardes) void { + for (p.recent.entries.items) |*e| e.changed = false; + p.recent.dirty = false; + s.pending.clearRetainingCapacity(); + for (s.closed.items) |*c| c.pending_at = null; +} + fn dropPending(s: *Store, gpa: std.mem.Allocator) void { _ = gpa; s.pending.clearRetainingCapacity(); -- cgit v1.3