diff options
Diffstat (limited to 'src/pardes.zig')
| -rw-r--r-- | src/pardes.zig | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/pardes.zig b/src/pardes.zig index a23039ef..a35d1604 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -7093,11 +7093,22 @@ pub const Pardes = struct { const from: panes.Output.Origin = .{ .query = w.kind }; const nrows = std.mem.count(u8, rows, "\n"); - if (panes.Output.traits(from).jumps and nrows == 1) { + if ((panes.Output.traits(from).jumps or w.kind == .diagnostics) and nrows == 1) { const ln = std.mem.trimEnd(u8, rows, "\n"); const place = ln[0..panes.Output.location(ln).end]; p.look_missed = false; look.lookAt(p, w.pane, place); + // The one place is the text's places, as a list's would be: tinted, + // and n and N step it. + const spot = look.parsePathLine(place); + if (!p.look_missed and spot.at.line > 0) if (p.panes[p.active]) |there| if (there.file) |*tf| if (spot.at.line <= panes.File.nlines(p.gpa, tf)) { + const ls = panes.File.lineStart(p.gpa, tf, spot.at.line - 1); + const line = tf.content[ls .. std.mem.indexOfScalarPos(u8, tf.content, ls, '\n') orelse tf.content.len]; + const col = @min(spot.at.col -| 1, line.len); + // To its end when the server said it, else the word there. + const end = if (spot.at.end_line == spot.at.line and spot.at.end_col > col) @min(spot.at.end_col, line.len) else if (look.expandedWord(line, col)) |word| word.hi else col + 1; + if (ls + end <= tf.content.len) there.places.feed(p, there, 0, &.{.{ .start = ls + col, .end = ls + end }}, ls + col); + }; // A word that asks for a list (Callers, Refs) with one answer // jumps to it with no list: where it went is said, as the list // would have shown it. A definition's jump is the answer itself. |
