diff options
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 a04cad46..f65d0683 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; |
