From 0e2012de121a9735d3c2ab7871a04d144636b849 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 23 Nov 2026 14:54:39 -0300 Subject: the Changes layer from the middle, and every way into a patch view: in a file at a revision a pinned change behind it (the revision or an ancestor) shows what it took away where it stood, and one ahead of it (a descendant) shows the lines it will write as read-only lines, green, where they will stand, the lines it will take away the revision's own text, red across, going; a change that is neither (a sibling) is left out (round 7's evidence, `layer-gone/mid2.py`: a deleted line's ghost a line late there, a change ahead drawn as behind); the causes: `carried` moved a pin's place through every later change's hunks, those ahead of the shown revision too, so jj's log now marks each change behind (`::REV`) or ahead (`logTemplate`: `p`/`c` behind, `a`/`d` ahead; the query takes the revset's changes behind or ahead and the unpinned ones between) and `carried` passes only the changes behind (`Hunk.ahead`); a pin ahead's places are carried back from its parent through the changes ahead before it (`carriedBack`), the lines it takes away marked (`Line.going`, its lane beside them: `going`), the lines it writes the layer's (`Ghost.Kind.added`), its description after them; and "a changed line's old text below the new where the guide says above": a replaced line the patch view's alignment does not pair was a line taken away standing after what was written in its place: now a diff's order, what went right above what came (lines taken away after a run's last changed line right after its new text; with none changed, before the lines written in their place), in the file's own pane and from the middle alike; Churn counts no change ahead; `Diff` with a word that names no file, in a jj repository, takes it for a revision (`Diff @-`, a bookmark): its patch with jj show's header (`jj.diffChange(..., any)`), the one way in that had none (round 7's table; `jj diff` prints no header, so its paged text has none to keep; a header was never dropped on purpose in core/hunks.zig's and core/diff.zig's history); the guide's chapter (the layer the pane's, its lines text and read-only, what an edit there says, what reads the file without them, from the middle, `Diff @-`), the cheatsheet's line, the `Changes` builtin's doc and both JSON lists; tests (core/jj.zig): "from the middle: in a revision's pane a pin behind it ... a pin ahead of it ..." (terminal and window), "a line replaced by one too unlike it ... a diff's order ...", "Diff with a revision jj takes (`@-`, a bookmark) ..."; not gated yet: jj's 44 tests pass (core-test filtered), the book builds Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- docs/typ/builtins-gui.json | 2 +- docs/typ/builtins-tui.json | 2 +- docs/typ/cheatsheet.typ | 2 +- docs/typ/guide.typ | 57 ++++++++++++++++++++++++++++------------------ 4 files changed, 38 insertions(+), 25 deletions(-) (limited to 'docs') diff --git a/docs/typ/builtins-gui.json b/docs/typ/builtins-gui.json index aeaf6953..eeb207af 100644 --- a/docs/typ/builtins-gui.json +++ b/docs/typ/builtins-gui.json @@ -10,7 +10,7 @@ {"name": "Callstack", "leader": "SPC l b", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Show outermost callers first, with signatures and call sites (gc)."}, {"name": "CallstackDepth", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "Caller levels collected by Callstack, 1 through 64; default 8. Bare, it says the current limit."}, {"name": "Changelog", "leader": "SPC h c", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "This build's version and what changed to reach it, printed into an output buffer the same way Config prints the live settings."}, - {"name": "Changes", "leader": "SPC t c", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Pin the changes `revset` names (jj) on a file's pane and show them in this view: a lane each after the line number, a line one added whole green, what the file no longer has drawn where it stood (ghost rows: a line taken away whole red, each change's description after its last line); bare, shown here or not (none pinned yet: `@`)."}, + {"name": "Changes", "leader": "SPC t c", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Pin the changes `revset` names (jj) on a file's pane and show them in every view of it: a lane each after the line number, a line one added whole green, what the file no longer has as lines of its text where it stood, read-only (a line taken away whole red, each change's description after its last line); bare, shown or not (none pinned yet: `@`)."}, {"name": "Churn", "leader": "SPC t u", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Count, for each declaration of a file's pane, the changes in `window` (jj) that touched it, and show it in this view: a heat lane after the line number and a strip by the scroll thumb, the line numbers' grey to the theme's red on a log scale; `window` a revset or a span of time (`3d`, `2w`, `6m`, `1y`); bare, shown here or not (none counted yet: the file's whole history)."}, {"name": "ClipPaste", "leader": "SPC p", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Paste the system clipboard after the selection."}, {"name": "ClipPasteBefore", "leader": "SPC P", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Paste the system clipboard before the selection."}, diff --git a/docs/typ/builtins-tui.json b/docs/typ/builtins-tui.json index 2263df44..a41b4466 100644 --- a/docs/typ/builtins-tui.json +++ b/docs/typ/builtins-tui.json @@ -10,7 +10,7 @@ {"name": "Callstack", "leader": "SPC l b", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Show outermost callers first, with signatures and call sites (gc)."}, {"name": "CallstackDepth", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "Caller levels collected by Callstack, 1 through 64; default 8. Bare, it says the current limit."}, {"name": "Changelog", "leader": "SPC h c", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "This build's version and what changed to reach it, printed into an output buffer the same way Config prints the live settings."}, - {"name": "Changes", "leader": "SPC t c", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Pin the changes `revset` names (jj) on a file's pane and show them in this view: a lane each after the line number, a line one added whole green, what the file no longer has drawn where it stood (ghost rows: a line taken away whole red, each change's description after its last line); bare, shown here or not (none pinned yet: `@`)."}, + {"name": "Changes", "leader": "SPC t c", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Pin the changes `revset` names (jj) on a file's pane and show them in every view of it: a lane each after the line number, a line one added whole green, what the file no longer has as lines of its text where it stood, read-only (a line taken away whole red, each change's description after its last line); bare, shown or not (none pinned yet: `@`)."}, {"name": "Churn", "leader": "SPC t u", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Count, for each declaration of a file's pane, the changes in `window` (jj) that touched it, and show it in this view: a heat lane after the line number and a strip by the scroll thumb, the line numbers' grey to the theme's red on a log scale; `window` a revset or a span of time (`3d`, `2w`, `6m`, `1y`); bare, shown here or not (none counted yet: the file's whole history)."}, {"name": "ClipPaste", "leader": "SPC p", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Paste the system clipboard after the selection."}, {"name": "ClipPasteBefore", "leader": "SPC P", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Paste the system clipboard before the selection."}, diff --git a/docs/typ/cheatsheet.typ b/docs/typ/cheatsheet.typ index a590e402..782836dc 100644 --- a/docs/typ/cheatsheet.typ +++ b/docs/typ/cheatsheet.typ @@ -119,7 +119,7 @@ Helix-style: motions *select*, then an edit acts on the selection. Mode box: bla == Reviewing diffs `git diff` output is a diff: #btn("B3") on a file line, an `@@` or a line's `+`/`-` jumps there. #doc("tags", section: "reviewing-diffs") -#word("Changes") `revset` on a file's pane: a lane a change (one change: green beside what it wrote, red beside what it took away), an arrow to its description, ghost rows for what it took away, #keys("] g", "[ g") from change to change; #btn("B3") on a change id: its patch, header first; #word("Churn") `3m`: each declaration's changes, grey to red; `a.zig@main:12` is a file at a revision. #doc("guide", section: "changes") +#word("Changes") `revset` on a file's pane (every view of it): a lane a change (one change: green beside what it wrote, red beside what it took away), an arrow to its description, what it took away as lines of the text, read-only (the cursor, a search, a yank, #btn("B2") and #btn("B3") work there; an edit there is refused), #keys("] g", "[ g") from change to change; #btn("B3") on a change id: its patch, header first; #word("Churn") `3m`: each declaration's changes, grey to red; `a.zig@main:12` is a file at a revision. #doc("guide", section: "changes") == Finding things - A query pane under the pane: line 1 the query, its first word the source: `/pat`, `Find name` (fuzzy), `Grep text` (literal), `Recent`, `Panes`, `Symbols`, `All`. #keys("Ctrl-n", "Ctrl-p") step, #key("Enter") lands and keeps the rows, #key("Esc") puts things back. #word("Help"), #word("Tutor"). diff --git a/docs/typ/guide.typ b/docs/typ/guide.typ index 985d324d..bc02298c 100644 --- a/docs/typ/guide.typ +++ b/docs/typ/guide.typ @@ -298,16 +298,16 @@ this view, and on again. = Changes on the source view -jj's changes drawn on a file's own pane, as layers each view wears or -not: the text stays the text (the patch view, `+Diff`, is unchanged). +jj's changes on a file's own pane, as a layer the pane wears or not: +the file's text stays the file's (the patch view, `+Diff`, is unchanged). Nothing is shown, and nothing asked of jj, until a word is run. #pairs( - [#word("Changes") `revset` (#key("SPC t c"))], [pins the revset's changes that touched the file on its pane (or a revision's) and shows them in this view; one set a pane (another view's revset replaces it there too). Bare: hidden in this view or shown again; with none pinned yet, `@`, the change against its parent], + [#word("Changes") `revset` (#key("SPC t c"))], [pins the revset's changes that touched the file on its pane (or a revision's) and shows them, in every view of the pane: their lines are the pane's text. Bare: hidden or shown again; with none pinned yet, `@`, the change against its parent], [#word("Churn") `window` (#key("SPC t u"))], [counts, for each declaration, the window's changes that touched it, and shows them in this view; the window a revset, or a span of time back from now (`3d`, `2w`, `6m`, `1y`). Bare: hidden or shown again; with none counted yet, the file's whole history], [#keys("] g", "[ g")], [the next and the previous change's first line], [`path@rev`, `path@rev:line`], [the file at a revision (#doc("guide", section: "revision")): a #word("Look") anywhere opens it], - [#word("Diff") `change` `path:line`], [a jj change's patch, its header (ids, author, dates, the whole message) above its hunks, in its own `+Diff`, the cursor on `path`'s line in it; a #word("Look") on a change id (eight of its letters, `k` to `z`, as `jj log` shows them) anywhere opens it at its top], + [#word("Diff") `change` `path:line`], [a jj change's patch, its header (ids, author, dates, the whole message) above its hunks, in its own `+Diff`, the cursor on `path`'s line in it; a #word("Look") on a change id (eight of its letters, `k` to `z`, as `jj log` shows them) anywhere opens it at its top; `Diff @-`, `Diff` a bookmark (a word that names no file): that revision's, the same], ) *Lanes.* Each pinned change gets a lane after the line number, from its @@ -320,22 +320,35 @@ it skipped), oldest first, so they are told apart. At a change's description its lane ends in an arrow to it. A line one added whole is green across the line. -*Ghost rows.* What the file no longer has is drawn where it stood, a row -of its own with no number: a line a change took away whole, red across; -a line a change changed, its old text right above it with the words that -went red, and on the line the words that came green (the patch view's +*Ghost lines.* What the file no longer has is in the pane as lines, +where it stood: a line a change took away whole, red across; a line a +change changed, its old text right above it with the words that went +red, and on the line the words that came green (the patch view's alignment says which lines are one line changed); each change's -description, `id title author age` (`3w`, `4m`), after its last line, in -its lane's colour (one change pinned: its id in the theme's keyword -colour), at one place after that change's own -ghost rows. The cursor steps over a ghost row, and search, selection and -the line numbers do not see it; a #btn("B3") on one looks at the word -there as anywhere, and on a description's id opens that change's patch -at the row for its last line here (`Diff id path:line`). It -moves the rows below down in this view alone. It is one row, cut where -the pane ends (never wrapped); in a narrow pane a description's title is -cut, its author and age kept. A hunk that took away more than 1,024 -lines shows none of them. +description, `id title author age` (`3w`, `4m`), its whole title and its +whole author, after its last line, in its lane's colour (one change +pinned: its id in the theme's keyword colour), at one place after that +change's own ghost lines. They are text, read-only: no line number (the +numbers are the file's, and `:N` is the file's line N), but the cursor +goes onto them, a selection runs through them, `/` finds in them, a text +object and a count work there, a yank takes them, #btn("B2") runs a word +of theirs and #btn("B3") looks at it (on a description's id: that +change's patch at the row for its last line here, `Diff id path:line`). +An edit that would change one (a key typed in it, a `d` or a paste over +it, a `J` into it) is refused whole, and says so on the notice line; the +file is never edited by it. What reads the file reads it without them: a +Save, `body`, `addr` and `dot` over 9P (a place in a ghost line is after +the file line above it), Edit, the language server, the syntax colours, +the dirty mark, the undo. A ghost line wraps as any line does; nothing is +cut. A hunk that took away more than 1,024 lines shows none of them. + +*From the middle.* In a file at a revision (`path@rev`), a pinned change +behind it (the revision or one of its ancestors) shows what it took away +as above; one ahead of it (a descendant) shows the lines it will write +as the ghost lines, green, where they will stand, and the lines it will +take away are the text's own, red across: going. A change that is +neither (a sibling) is not shown: its lines are no revision's on this +one's line. *Churn.* A cell after the line number, from the line numbers' grey to the theme's red on a log scale of the count against the file's hottest @@ -348,11 +361,11 @@ what it had under another name before a move is not counted. jj answers once, when the word is run, on a worker (the editor goes on); its answer is lined up with the pane's text as it is then (lines typed -before jj's last snapshot or while it ran), and the lanes, ghost rows and +before jj's last snapshot or while it ran), and the lanes, ghost lines and counts ride with the lines through the edits made since. A place inside -lines rewritten since jj's snapshot has no ghost row. A change between +lines rewritten since jj's snapshot has no ghost line. A change between two pinned ones that the revset does not pin still moves the older ones' -ghost rows to where they stand. +ghost lines to where they stand. = Call hierarchy -- cgit v1.3