diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 05:26:46 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | bb9bd1ccafd9d18079b4a862a44760c08240e54d (patch) | |
| tree | bd5d161ce3973fc42efffee6c3e80d2f72238ed0 | |
| parent | 2ca2813207403ca8e9ffe75e8bb96945df2b1bd0 (diff) | |
| download | pardes-bb9bd1ccafd9d18079b4a862a44760c08240e54d.tar.gz pardes-bb9bd1ccafd9d18079b4a862a44760c08240e54d.zip | |
A look that makes a +Search pane reads back that pane
With LookWord list, or in a terminal, a look lists every place in a
+Search pane, yet look read back the source pane, as if the hit were
selected there. It now reads back the +Search pane it made.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
| -rw-r--r-- | src/ninep/ctl.zig | 15 |
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" { |
