diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 16:12:18 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 16:23:31 -0300 |
| commit | e4bda7e899089b0c8594ad1b03099402bddeeef1 (patch) | |
| tree | 2972000d9c446cf51088b610610105fa5430a082 /core/Stream.zig | |
| parent | d3f9f3775e2efbcb4d617afb4a18eaf5efa72e29 (diff) | |
| download | pardes-e4bda7e899089b0c8594ad1b03099402bddeeef1.tar.gz pardes-e4bda7e899089b0c8594ad1b03099402bddeeef1.zip | |
Query rows: what a step asks a worker to paint no longer hangs on the colours this process happens to have: the bytes soak's 'the core called search where the tape has a host' (g6, seed 5 at 80 ms, the witness parting at the session's own step) was a query row's colours read by the step that decides whether to ask a worker for its file's paint (Stream.paintRows, an effect on the tape): Query.writePlacesRows (Query.zig:1073) took a `/` row's colours from the owner's frame paint (File.highlights, painted by refreshHighlights, derived) and only a row left plain went to Shades.of, which asked; Shades.of asked only on a miss in the locations cache (derived: a dump carries none, so a client joined since has none); recolor asked only for rows whose colours were still zeros (derived); so a session that had drawn its owner, or had the file's colours from an earlier paint, asked nothing where a replica that never draws, or a client joined since, asked a worker (and its stream.rows_count, rows_paint, rows_asked, rows_asked_at moved on one side only: the four fields the witness named); FIRST the tests (core/replica.zig, a session whose host paints on workers): 'a client joined from a dump asks a worker for a `/` query's colours as the session does, though only the session has drawn its owner' and '... though only the session has them from an earlier paint', both on the base 'diverged: the core called search where the tape has a done (0)'; then the fix: Shades asks for every file its rows show (Shades.file at every row, whatever colours it has; Shades.done at the file's end and each walk's), paintRows decides on replicated state alone (the row ring, the pending paint, the pane's text), its key the path's hash (a file is painted once between two Greps, not again at each revision of an open text, which a frame paints where it is seen); a row's colours still come from the frame's paint and the cache, out of the rows' digest as before; root.zig's kept_out lines for highlights and locations_cache say so
Diffstat (limited to 'core/Stream.zig')
| -rw-r--r-- | core/Stream.zig | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/core/Stream.zig b/core/Stream.zig index 1f4a7405..78f6ef41 100644 --- a/core/Stream.zig +++ b/core/Stream.zig @@ -245,10 +245,10 @@ ahead_seen: struct { serial: u32 = 0, scroll: usize = 0, dir: i2 = 1 } = .{}, /// the next asked when it lands (Query.recolor); a worker per file if a /// Grep of hundreds of files colours too slowly. rows_paint: ?TextTask = null, -/// The files (a hash of path and revision) asked since the last Grep -/// began: each asked once, so a file whose colours never fit its rows -/// (changed on disk since) is not painted again and again. ponytail: a -/// ring of 256; the oldest forgotten. +/// The files (a hash of the path) asked since the last Grep began: each +/// asked once, so a file whose colours never fit its rows (changed on +/// disk since, an edit) is not painted again and again. ponytail: a ring +/// of 256; the oldest forgotten. rows_asked: [256]u64 = @splat(0), rows_asked_at: u8 = 0, /// Rows asked for their colours while a 9P write was served: asked again @@ -352,17 +352,13 @@ pub fn askAhead(p: *Pardes) void { /// from disk there. Kept in the locations cache when it lands, where the /// rows find them (Query.Shades). Not without workers (the rows stay /// plain), nor for a file bigger than `max_rows_paint_bytes`, nor twice for -/// one revision of a file. +/// a file between two Greps. Asked after every file's rows, whatever +/// colours they have here: those are this process's own (what its frames +/// painted of the text, what its locations cache kept: in no digest), and +/// what a step asks of a worker must not hang on them. pub fn paintRows(p: *Pardes, path: []const u8) void { const s = &p.stream; if (s.rows_paint != null or !p.tape.has(p, .search)) return; - // Asked while a 9P write is served (a script's Grep): not now, as no - // paint is (the write would wait for it to settle); the next step asks. - if (p.fs.serving) { - s.rows_later = true; - return; - } - if (!syntax.readyApart(path)) return; var content: ?[]const u8 = null; var revision: u32 = 0; for (p.panes) |slot| if (slot) |pane| if (pane.file) |f| if (f.output == null and std.mem.eql(u8, f.path, path)) { @@ -371,8 +367,15 @@ pub fn paintRows(p: *Pardes, path: []const u8) void { break; }; if (content) |c| if (c.len > max_rows_paint_bytes) return; - const key = std.hash.Wyhash.hash(revision, path) | 1; + const key = std.hash.Wyhash.hash(0, path) | 1; if (std.mem.indexOfScalar(u64, &s.rows_asked, key) != null) return; + if (!syntax.readyApart(path)) return; + // Asked while a 9P write is served (a script's Grep): not now, as no + // paint is (the write would wait for it to settle); the next step asks. + if (p.fs.serving) { + s.rows_later = true; + return; + } const job = TextJob.make(p.gpa, 0, revision, 0, path, content orelse "") orelse return; s.rows_asked[s.rows_asked_at] = key; s.rows_asked_at +%= 1; |
