summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index d3b008ff..7d5f0ca0 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -80,9 +80,8 @@ pub fn run(p: *Pardes, id: usize, exec: bool, text: []const u8, in_tag: bool) vo
const after = Serials.snapshot(p);
var created = false;
for (after.list[0..after.len]) |serial| if (std.mem.indexOfScalar(u32, before.list[0..before.len], serial) == null) {
- // A look's hits buffer is how it found the text, not where: it
- // answers the pane the hit is selected in.
- if (!exec) if (p.paneBySerial(serial)) |made| if (p.panes[made].?.file) |f| if (f.output) |o| if (o.from == .search) continue;
+ // A look that made a +Search pane (LookWord list, a terminal)
+ // answers it: that is where the places it found are.
noteResult(p, serial);
created = true;
};
@@ -1702,6 +1701,16 @@ test "a looked word is found in its own pane, next place after the dot, wrapping
after = 0;
for (p.panes) |slot| after += @intFromBool(slot != null);
try testing.expect(after > count);
+ // ...and look reads back that +Search pane, where the places are.
+ var listed = false;
+ var rows = std.mem.tokenizeScalar(u8, rd(p, look_node, 0, 256).bytes, '\n');
+ while (rows.next()) |row| {
+ const made = p.panes[p.paneBySerial(try std.fmt.parseInt(u32, row, 10)).?].?;
+ if (made.file) |f| if (f.output) |o| if (o.from == .search) {
+ listed = true;
+ };
+ }
+ try testing.expect(listed);
}
test "each word's /commands description is its own doc comment's first sentence, no citation" {