summaryrefslogtreecommitdiff
path: root/core/panes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-21 09:46:32 -0300
committerGabriel Schneider <[email protected]>2026-11-21 14:17:20 -0300
commitdfb051bd798f65c2217eea7f95b03dce292e30bf (patch)
tree4307ce068343f57de735be1ee7f6093ea106f4f8 /core/panes.zig
parentc4f7bb9477c7aa4c8864f14edb9e85b6c8c08437 (diff)
downloadpardes-dfb051bd798f65c2217eea7f95b03dce292e30bf.tar.gz
pardes-dfb051bd798f65c2217eea7f95b03dce292e30bf.zip
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
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/panes.zig')
-rw-r--r--core/panes.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/panes.zig b/core/panes.zig
index 5277ebba..ee03ccf2 100644
--- a/core/panes.zig
+++ b/core/panes.zig
@@ -320,6 +320,9 @@ pub const Pane = struct {
view: SessionView = .{},
/// The painters a file's body wears in this view (File.Layers).
layers: File.Layers = .{},
+ /// What jj answered for the last `Changes` in any view (jj.zig): the
+ /// pane's, so a client that joins late has it in the dump.
+ changes: ?*@import("jj.zig").Changes = null,
sel: [3]Sel = @splat(.{}),
pointer_selections: [3]?PointerSelection = @splat(null),
next_pointer_selection: u64 = 0,
@@ -1279,6 +1282,11 @@ pub fn teardownPane(p: *Pardes, pane: *Pane) void {
pane.input.deinit(p.gpa);
pane.jump.deinit(p.gpa);
pane.places.deinit(p.gpa);
+ if (pane.changes) |changes| {
+ changes.deinit(p.gpa);
+ p.gpa.destroy(changes);
+ pane.changes = null;
+ }
if (pane.query) |q| {
q.deinit(p.gpa);
p.gpa.destroy(q);