diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-24 22:24:29 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-24 22:24:29 -0300 |
| commit | 89b3e7365bac28c4cd7d52d40c1786c01db5af52 (patch) | |
| tree | dcc65675b340f4ba93bfcf8d4edd9c7a4d16dc6c /core/jj.zig | |
| parent | b44a129a8854483dbe45ce2bcfa09f33ccbd6e8c (diff) | |
| download | pardes-89b3e7365bac28c4cd7d52d40c1786c01db5af52.tar.gz pardes-89b3e7365bac28c4cd7d52d40c1786c01db5af52.zip | |
body_layer: a motion root's level paints its targets in the gutter while it shows: `g` its first and last lines, the window's top and bottom and the last edit (`g e t b .`); `]` the next and `[` the previous function, paragraph, test, comment, change, diagnostic, type and argument (`f p T c g d t a`); browsing `m` unrolled on `a` or `i` tints the brackets' region around the caret (pick-ui SPEC §4.4, walk UI line F item 2): the keys are the level's own (bindings.level, each leaf's role), each target looked for in the rows shown alone and a target off them not painted (the tag's arrows of §15 not built): the tree objects through syntax.objectNext given the shown bytes (QueryCursor.setByteRange; the motion passes null), `]g` through jj.nextChange bounded to the shown lines (`most`; the motion unbounded), `]d` a binary search of the fed diagnostics, `]p` the shown lines, `g t`/`g b` normal.gotoWindow's rows; drawn into the body as the `gw` labels are (R3), never written; at rest one test of the view's tag state (TagState.hostOf); the tree is the one the motion reads (normal.fileTree, made once a revision), not painted while the Changes layer's lines are in the buffer; TEST: body_layer.zig "a motion root's level paints its targets in the gutter ..." (`]` p, `g` g e, `m` on i tinted, rest as before); core-test 1025/1192 (167 skipped), 0 failed, load 9
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'core/jj.zig')
| -rw-r--r-- | core/jj.zig | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/jj.zig b/core/jj.zig index c1d07662..7f1e5623 100644 --- a/core/jj.zig +++ b/core/jj.zig @@ -2030,14 +2030,15 @@ fn ownerOf(ch: *const Changes, f: *const File.State, row: usize) PinIndex { /// The line `]g` (`forward`) or `[g` goes to from buffer line `from` of /// the pane: the next or the previous change's first line (the first of a /// run of lines one pin wrote or took away: a ghost line is a line); null -/// with none shown, or none that way. -pub fn nextChange(p: *Pardes, pane: *const Pane, from: usize, forward: bool) ?usize { +/// with none shown, or none that way, or none in the `most` lines looked +/// at (a body's painted targets look at the rows shown alone). +pub fn nextChange(p: *Pardes, pane: *const Pane, from: usize, forward: bool, most: usize) ?usize { if (pane.layers.lanes == 0) return null; const f = if (pane.file) |*file| file else return null; const ch = answered(p, f.layer.owner) orelse return null; const n = File.lineCount(f.content); var row = from; - while (true) { + for (0..most) |_| { if (forward) { row += 1; if (row >= n) return null; @@ -2048,6 +2049,7 @@ pub fn nextChange(p: *Pardes, pane: *const Pane, from: usize, forward: bool) ?us const owner = ownerOf(ch, f, row); if (owner != .none and (row == 0 or ownerOf(ch, f, row - 1) != owner)) return row; } + return null; } /// A Look (B3) at column `col` of body row `vr` of pane `id` on the id of |
