summaryrefslogtreecommitdiff
path: root/src/Query.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Query.zig')
-rw-r--r--src/Query.zig21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/Query.zig b/src/Query.zig
index 49f58a0e..2f417a68 100644
--- a/src/Query.zig
+++ b/src/Query.zig
@@ -48,6 +48,7 @@ const memory = @import("memory.zig");
const Names = @import("Names.zig");
const Places = @import("Places.zig");
const Stream = @import("Stream.zig");
+const Store = @import("Store.zig");
const Surface = @import("surface.zig").Surface;
const Pardes = pardes.Pardes;
const Pane = panes.Pane;
@@ -591,12 +592,9 @@ fn startSource(p: *Pardes, id: usize, q: *Query, source: Source, owner_id: ?usiz
if (p.fs.serving) Stream.step(p);
},
.recent => {
- // Every window's files: what the others wrote since, read.
- p.store.refresh(p);
var out: std.Io.Writer.Allocating = .init(gpa);
defer out.deinit();
- Output.recentText(p, &out.writer, true) catch {};
- var lines = std.mem.splitScalar(u8, out.written(), '\n');
+ var lines = std.mem.splitScalar(u8, pardes.tape.authority(recentRows, .{ p, &out }), '\n');
while (lines.next()) |ln| {
if (ln.len == 0) continue;
const rel = Names.relative(ln, dir);
@@ -617,10 +615,9 @@ fn startSource(p: *Pardes, id: usize, q: *Query, source: Source, owner_id: ?usiz
}
// Then the panes this session closed, the latest first, each
// `(closed)` and dimmer (makeNameRows): Enter brings one back
- // where it was. Its name alone is matched, not the word.
- var i = p.store.closed.items.len;
- while (i > 0) : (i -= 1) {
- const c = p.store.closed.items[i - 1];
+ // where it was. Its name alone is matched, not the word. The
+ // store's, which a replica has from the authority.
+ for (pardes.tape.authority(Store.closedNames, .{p})) |c| {
var buf: [4096 + 48]u8 = undefined;
const row = std.fmt.bufPrint(&buf, config.pane_addr ++ "{d} {s}" ++ closed_word, .{ c.serial, Names.relative(c.name, dir) }) catch continue;
const key_at = std.mem.indexOfScalar(u8, row, ' ').? + 1;
@@ -652,6 +649,14 @@ fn startSource(p: *Pardes, id: usize, q: *Query, source: Source, owner_id: ?usiz
/// What a Panes row of a closed pane ends with.
const closed_word = " (closed)";
+/// Every window's files, as a Recent query lists them: what the others
+/// wrote since, read first. The store's (`tape.authority`): in `out`.
+fn recentRows(p: *Pardes, out: *std.Io.Writer.Allocating) []const u8 {
+ p.store.refresh(p);
+ Output.recentText(p, &out.writer, true) catch {};
+ return out.written();
+}
+
/// The owner's declarations, from a parse that already exists: its sticky
/// headers' (TreeContext) at this revision, or the locations cache's. None
/// is made here, on the loop, unless `small` and the text is small: a