summaryrefslogtreecommitdiff
path: root/src/normal.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/normal.zig')
-rw-r--r--src/normal.zig28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/normal.zig b/src/normal.zig
index ebace536..f5bdb9dc 100644
--- a/src/normal.zig
+++ b/src/normal.zig
@@ -757,22 +757,18 @@ fn executeNormalAction(p: *Pardes, t: *Text, semantic: modal.Normal.Action) void
.add_newline => |newline| return edit.addNewline(p, t, newline.direction == .forward, newline.count),
.diagnostic => |diagnostic| {
const fwd = diagnostic.direction == .forward;
- if (!diagnostic.endpoint) {
- if (panes.Output.resultsFrom(p, pane, .{ .query = .diagnostics }) and
- look.searchStep(p, p.active, if (fwd) 1 else -1)) return;
- return p.lspRequest(p.active, .diagnostics, "");
- }
- if (!panes.Output.resultsFrom(p, pane, .{ .query = .diagnostics }))
- return p.lspRequest(p.active, .diagnostics, "");
- if (!fwd) {
- pane.search_row = null;
- _ = look.searchStep(p, p.active, 1);
- return;
- }
- const rp = p.panes[pane.search_pane orelse return] orelse return;
- const rf = rp.file orelse return;
- pane.search_row = std.mem.count(u8, rf.content, "\n");
- _ = look.searchStep(p, p.active, -1);
+ // Once a Diagnostics query fed them, the diagnostics are this
+ // text's places: ]d and [d step them as n and N do, ]D and [D
+ // go to the last and the first. Until then, asked for.
+ const set = &pane.places;
+ const fed = set.started and set.provenance == .list and if (p.paneBySerial(set.from)) |qid|
+ (if (p.panes[qid].?.query) |q| q.source == .diagnostics else false)
+ else
+ false;
+ if (!fed) return p.lspRequest(p.active, .diagnostics, "");
+ if (!diagnostic.endpoint) return set.step(p, pane, fwd, 1, false);
+ if (set.hits.items.len == 0) return;
+ set.goTo(pane, if (fwd) set.hits.items.len - 1 else 0, false);
},
.move => |move| switch (move.motion) {
.left => {