diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-22 00:38:01 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-22 01:10:07 -0300 |
| commit | 20cbd62897519355d4680267064711d829ef5800 (patch) | |
| tree | f51397852b3ac332bb36fde61170271bfacf5768 /core/File.zig | |
| parent | 2015baa4ccd26a74b51e7b7cda0eb3533a325142 (diff) | |
| download | pardes-20cbd62897519355d4680267064711d829ef5800.tar.gz pardes-20cbd62897519355d4680267064711d829ef5800.zip | |
layers: `Churn [window]` (slice 7): for each declaration of a file's pane (tree-sitter's innermost, as TreeContext finds them: `f.context.declarations`), how many of the window's changes touched it, shown in this view as a heat lane after the line number (a half block, before the changes' lanes, which stay next to the text they mark: `File.Layers.heat`, one cell) and as a strip by the scroll thumb (a rail row each, the hottest of its lines: the rail's second cell in a terminal, `Surface.heat` for a window, drawn beside the track by gui.zig's paneDecor), smooth from the line numbers' grey to the theme's red (`jj.themeRed`) in Oklab on a log scale of the count against the file's hottest (`heatColour`); the window a revset, or a span of time back from now (`3d`, `2w`, `6m`, `1y`: `::(REV) & author_date(after:"N units ago")`), bare shown here or not and with none counted yet the file's whole history `::(REV)`; jj's data as `Changes`' is: one `jj log` of the window and the changes after it to the shown revision with their hunks (the same query and marks, `Ask.kind` `.churn`) and `jj file show` of the revision (to line the counts up with the pane's text, `Moved.of`), on the worker, its raw answer an input; kept raw in the session's jj state (`jj.Heat`, `Session.heats`) until the text's declarations are there, then counted in every process (`heatOf`, `parsed`): a big file's parse is a worker's (`Stream.parseFor`, its landing tells `jj.parsed`), never the loop's (counted on the loop, core/replica.zig held a Debug loop 1,211 ms; now its longest hold is 10.7 ms; the counting itself 1 ms); a change counts once a declaration, a hunk's lines carried to the shown revision through the later changes' hunks; the counts ride with the lines through edits (`spliceValues`, shared with `Changes`' lines); a later ask of the other kind no longer drops an answer (the stale check is per kind); tests: f three changes, g two: `3 3 3 0 2 2 2`, the cell red on f, `mixOklab(grey, red, ln 3 / ln 4)` on g, none on the blank line, the strip's first row red, in a terminal and a window, bare off and on without asking jj; `@--::@` one each, `1w` all, a refusal in jj's words; on a worker, counted when the worker's parse lands, the client equal; a line deleted takes its count, the client and digest equal; core-test 912/1072 (160 skipped), shell-test 1114/1117 (3 skipped)
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/File.zig')
| -rw-r--r-- | core/File.zig | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/core/File.zig b/core/File.zig index 347f4809..c4fc8a38 100644 --- a/core/File.zig +++ b/core/File.zig @@ -373,7 +373,7 @@ pub fn gutterWidth(pane: *const Pane) u16 { var lines = if (file.line_starts.len > 0) file.line_starts.len else lineCount(file.content); var digits: u16 = 1; while (lines >= 10) : (lines /= 10) digits += 1; - return @max(config.PREFIX_W, digits + 1) + laneCells(pane); + return @max(config.PREFIX_W, digits + 1) + laneCells(pane) + pane.layers.heat; } /// The cells the changes' lanes take after the line number in this view @@ -758,7 +758,7 @@ fn edit(p: *Pardes, f: *State, off: usize, len: usize, bytes_in: []const u8, who }; reportEdit(p, f, off, len, bytes); // A pinned change's per-line values ride with the lines (jj.zig). - if (p.changes.answers.items.len > 0) jj.edited(p, f, off, len, bytes); + if (p.changes.answers.items.len | p.changes.heats.items.len > 0) jj.edited(p, f, off, len, bytes); if (f.mini) |*mini| mini.deinit(p.gpa); f.mini = null; if (f.line_starts.len > 0) shiftIndex(p.gpa, f, off, len, bytes); @@ -1779,7 +1779,7 @@ fn geometryKey(pane: *const Pane, f: *const State) u64 { if (f.output) |o| pardes.walk.digest(Output.Origin, &o.from) else 0, std.hash.Wyhash.hash(0, f.path), f.tree_context, f.context.revision orelse 0, f.context.declarations.len, f.line_starts.len, t.revision orelse 0, t.list.items.len, pane.view.wrap, pane.view.layered, pane.view.body_h, pane.view.tagline_h, - pane.view.rect_h, laneCells(pane), + pane.view.rect_h, laneCells(pane) + @as(u16, pane.layers.heat), }; // One hash of them laid out as words: every reader of the map asks for // this key, a hundred times a frame. @@ -1797,8 +1797,8 @@ fn geometryKey(pane: *const Pane, f: *const State) u64 { fn fillBody(comptime ghosted: bool, tab: u16, dst: ?[]u8, pane: *Pane, f: *State, width: usize, record_wrap: bool) usize { if (record_wrap) pane.wrap_n = 0; const prefix_width = gutterWidth(pane); - // Where a number ends: a blank, then the lanes (laneCells), after it. - const number_end = prefix_width -| laneCells(pane) -| 1; + // Where a number ends: a blank, then the heat lane and the lanes after it. + const number_end = prefix_width -| laneCells(pane) -| pane.layers.heat -| 1; const total = nlines(pane.gpa, f); // The slot after the text's last newline, found once: every numbered // row below asks whether it is that one. @@ -1949,9 +1949,12 @@ pub const Layers = struct { /// frontend, in a window two, which its strips of pixels fill one and /// a half of (Surface.Lane), in a terminal three, a glyph each. lanes: u8 = 0, + /// Whether this view shows the pane's churn (`Churn`, jj.Heat), as the + /// cells its lane takes: one after the number, before the lanes. + heat: u8 = 0, pub fn digest(l: *const Layers, h: *pardes.walk.Hasher) void { - h.update(&.{ @intFromBool(l.ink), l.lanes }); + h.update(&.{ @intFromBool(l.ink), l.lanes, l.heat }); } }; |
