summaryrefslogtreecommitdiff
path: root/core/jj.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/jj.zig')
-rw-r--r--core/jj.zig8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/jj.zig b/core/jj.zig
index 05daeef6..dea0236f 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