summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/panes.zig5
-rw-r--r--src/pardes.zig14
2 files changed, 12 insertions, 7 deletions
diff --git a/src/panes.zig b/src/panes.zig
index 09225068..886d4b28 100644
--- a/src/panes.zig
+++ b/src/panes.zig
@@ -2600,8 +2600,9 @@ pub const Output = struct {
try openStepped(p, id, .{ .cmd = .ThemeSel }, content);
}
- pub fn isWalkRow(out: ?State, line: []const u8) bool {
- const state = out orelse return true;
+ pub fn isWalkRow(file: *const File.State, row: usize, line: []const u8) bool {
+ const state = file.output orelse return true;
+ if (usesLocationsConfig(state.from)) return isResultRow(file, row);
if (!std.meta.eql(state.from, Origin{ .cmd = .ThemeSel })) return true;
// Section labels are for reading, not stops in the command walk.
return std.mem.startsWith(u8, std.mem.trimStart(u8, line, " \t"), comptime config.Runtime.findAction(.theme).?.word ++ " ");
diff --git a/src/pardes.zig b/src/pardes.zig
index eb0a442f..294e6812 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -9636,7 +9636,7 @@ pub const Pardes = struct {
if (budget.* == 0) return null;
budget.* -= 1;
const ln = lines[@intCast(r)];
- if (pane.file) |f| if (!panes.Output.isWalkRow(f.output, ln)) continue;
+ if (pane.file) |*f| if (!panes.Output.isWalkRow(f, @intCast(r), ln)) continue;
const on_start = r == start;
switch (grain) {
.word => {
@@ -9658,10 +9658,14 @@ pub const Pardes = struct {
// one span per row, so there is nothing to keep and nothing to
// scan past: the row either offers it or it does not
.line, .whole => {
- const sp = (if (grain == .line)
- look.lineSpan(p, ln, dir, &realbuf)
- else
- wholeRowSpan(ln)) orelse continue;
+ const sp = span: {
+ if (grain == .whole) break :span wholeRowSpan(ln);
+ if (pane.file) |f| if (@as(usize, @intCast(r)) < f.location_rows.len) {
+ const end = f.location_rows[@intCast(r)].location_end;
+ if (end > 0) break :span @as(?look.Span, .{ .start = 0, .end = end });
+ };
+ break :span look.lineSpan(p, ln, dir, &realbuf);
+ } orelse continue;
const col0: i32 = @intCast(sp.start);
if (lookPast(col0, from, on_start, delta))
return .{ .row = r, .col0 = col0, .col1 = @intCast(sp.end - 1) };