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 --- core/surface.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'core/surface.zig') diff --git a/core/surface.zig b/core/surface.zig index 6e05f25f..653abd82 100644 --- a/core/surface.zig +++ b/core/surface.zig @@ -147,6 +147,10 @@ pub const MAX_REGIONS = 1 + MAX_PANES * (4 + panes.Pane.Notices.max) + pardes.MA /// to a detached session draws them from the frame alone. pub const RailTick = struct { owner: u8, at: u16, current: bool }; pub const max_rail_ticks = 4096; +/// A pinned change's lane on a body row (jj.paint): a pixel shell draws +/// 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 }; pub const rail_tick_scale = 1024; pub const Chrome = struct { @@ -256,6 +260,12 @@ pub const Surface = struct { /// rail's track, the pane's current match's marked. rail_ticks: [max_rail_ticks]RailTick = undefined, nrail_ticks: u16 = 0, + /// The lanes of the changes pinned on the bodies, for a pixel shell + /// (in a terminal they are glyphs in the cells): the frame's own + /// surface's, gpa's, as `placements` (a list, not an array: a frame + /// makes many a temporary Surface, and a safe build fills an array's + /// `undefined` in each). + lanes: std.ArrayList(Lane) = .empty, chrome: Chrome = .{}, cells: []Cell = &.{}, /// bar: draw an insert-style thin cursor instead of the block -- cgit v1.3