summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CHANGELOG.md8
-rw-r--r--src/Store.zig21
2 files changed, 19 insertions, 10 deletions
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();