summaryrefslogtreecommitdiff
path: root/core/surface.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-22 00:38:01 -0300
committerGabriel Schneider <[email protected]>2026-11-22 01:10:07 -0300
commit20cbd62897519355d4680267064711d829ef5800 (patch)
treef51397852b3ac332bb36fde61170271bfacf5768 /core/surface.zig
parent2015baa4ccd26a74b51e7b7cda0eb3533a325142 (diff)
downloadpardes-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/surface.zig')
-rw-r--r--core/surface.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/surface.zig b/core/surface.zig
index 653abd82..3ab9a933 100644
--- a/core/surface.zig
+++ b/core/surface.zig
@@ -151,6 +151,9 @@ pub const max_rail_ticks = 4096;
/// it as a strip in gutter cell `x`, at its `level`'s place (sample A of
/// the ruled design: each a third of a cell wide, half that of air between).
pub const Lane = struct { x: u16, y: u16, level: u8, rgb: [3]u8 };
+/// Churn's strip on a rail (jj.railHeat): a pixel shell draws its row of
+/// pane `owner`'s rail, beside the track, in `rgb`.
+pub const Heat = struct { owner: u8, row: u16, rgb: [3]u8 };
pub const rail_tick_scale = 1024;
pub const Chrome = struct {
@@ -266,6 +269,9 @@ pub const Surface = struct {
/// makes many a temporary Surface, and a safe build fills an array's
/// `undefined` in each).
lanes: std.ArrayList(Lane) = .empty,
+ /// Churn's strips by the scroll thumbs, for a pixel shell (in a
+ /// terminal the rail's cells), as `lanes`.
+ heat: std.ArrayList(Heat) = .empty,
chrome: Chrome = .{},
cells: []Cell = &.{},
/// bar: draw an insert-style thin cursor instead of the block