From dfb051bd798f65c2217eea7f95b03dce292e30bf Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sat, 21 Nov 2026 09:46:32 -0300 Subject: layers: `Changes [revset]` pins a revset's changes on a file's pane in this view (bare `@`, bare again off, another replaces; refusals in jj's words) and draws them: what jj says is asked in two recorded answers (Site.jj), `jj log -p --git --context=0` restricted to the file (the pins: id, author, time, the description's first line, and each one's diff, read with diff.zig's walk into hunks and the removed lines' text) and `jj file annotate` at the shown revision (which pin wrote each line), kept as flat arrays in the pane (Pane.changes: replicated, a late joiner has them in the dump, a client never runs jj) and worn by the view whose revset is File.Layers.revset; a pin's lane runs unbroken from a line it wrote to the next while every line between is a newer pin's, so lanes nest, the spine keeping its place and a nested change a level to the right on its rows only, three levels in a gutter the lanes widen (a window two cells, strips of a third of a cell with half that of air: Surface.lanes, drawn by the gui; a terminal three, a `▎` a level), coloured by the theme's accents but its green and red in hue order from the top, one within 15 degrees of the last kept skipped (doom one: magenta, blue, yellow), oldest first; a line a pin added whole (in a run it took away and wrote, past as many as it took away) is green across the line as a diff's added line; with Changes off nothing is drawn and the gutter is as it was; tests: the data through the pane (pins, lines, hunks, removed text, unpin, `@` touching nothing, a refusal), a client replaying it ends equal, the lanes and grounds of a three-deep stack in a terminal's cells and a window's strips; core-test 895/1055 (160 skipped), shell-test 1097/1100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- dev/gui/gui.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'dev/gui/gui.zig') diff --git a/dev/gui/gui.zig b/dev/gui/gui.zig index aa28a3f0..47fd14d5 100644 --- a/dev/gui/gui.zig +++ b/dev/gui/gui.zig @@ -4876,6 +4876,16 @@ fn buildDecor(g: *Gui, gpa: std.mem.Allocator, surface: *const pardes.Surface, g } else false; if (grid_bottom < win_h and tag_last) try addDecor(g, gpa, 0, grid_bottom, win_w, win_h, chrome.tag_bg, 1, win_w, win_h); try paneDecor(g, gpa, regions, surface.rail_ticks[0..surface.nrail_ticks], chrome, layout, surface.cols, surface.rows, win_w, win_h); + // The changes' lanes (jj.paint): a strip a level in the gutter's + // lane cells, each a third of a cell wide with half that of air + // before it, so three take one and a half cells (the ruled + // sample A); whole pixels, so every row's strip lines up. + for (surface.lanes.items) |lane| { + const w = @max(1, @round(layout.w / 3)); + const x0 = @round(@as(f32, @floatFromInt(lane.x)) * layout.w + w / 2 + @as(f32, @floatFromInt(lane.level)) * (w + w / 2)); + const y0 = @as(f32, @floatFromInt(lane.y)) * layout.h; + try addDecor(g, gpa, x0, y0, x0 + w, y0 + layout.h, lane.rgb, 1, win_w, win_h); + } // A single spine runs down each column, through every tag and body. for (regions) |column| { if (column.kind != .column) continue; -- cgit v1.3