summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 04:45:20 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commitbda5b5f621d0edd8e26f9700043ab21cae18f329 (patch)
treeb183df1b137f405a9dcecfe32769e374d2da5c50 /src/ninep/ctl.zig
parent85d5467023a9db801d8ea2538e9611b71cd10d9d (diff)
downloadpardes-bda5b5f621d0edd8e26f9700043ab21cae18f329.tar.gz
pardes-bda5b5f621d0edd8e26f9700043ab21cae18f329.zip
A looked word selects its next place in its own pane, as acme's look3
A plain word looked at (a look write, a right click, an ML record written back) opened another identically named +Search pane each time, until the panes ran out, and never wrapped. As acme's look3 searches the text for it (look.c:210), it now selects the word's next place in that pane after the dot, wrapping at the end, and opens nothing. LookWord list, a new root setting, keeps the +Search listing (search is the default); the rsearch snapshot and an output test that walk the listing say LookWord list. (The leader-path check over every builtin gets a comptime branch quota, as one more builtin took the GUI build past the default.) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index fac1e5eb..f40825e3 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -1588,3 +1588,26 @@ test "a file changed on disk under unsaved edits is not reloaded: it says so, ge
try testing.expect(std.mem.indexOf(u8, first.reply.ename, "modified on disk since read") != null);
try testing.expect(wr(p, Node.of(serial, .ctl), "Save\n").saved);
}
+
+test "a looked word is found in its own pane, next place after the dot, wrapping, and opens no pane" {
+ const p = try withFile(testing.allocator, "foo x foo y\n");
+ defer p.deinit();
+ const serial = serialOf(p);
+ const look_node = Node.of(serial, .look);
+ const dot = Node.of(serial, .dot);
+ var count: usize = 0;
+ for (p.panes) |slot| count += @intFromBool(slot != null);
+ for ([_][]const u8{ " 0 3 ", " 6 9 ", " 0 3 " }) |want| {
+ try testing.expectEqual(Status.ok, wr(p, look_node, "foo\n").reply.status);
+ try testing.expectEqualStrings(want, rd(p, dot, 0, 64).bytes);
+ }
+ var after: usize = 0;
+ for (p.panes) |slot| after += @intFromBool(slot != null);
+ try testing.expectEqual(count, after);
+ // LookWord list: the +Search listing, as before.
+ try testing.expect(p.executeBuiltinLine(0, "LookWord list"));
+ try testing.expectEqual(Status.ok, wr(p, look_node, "foo\n").reply.status);
+ after = 0;
+ for (p.panes) |slot| after += @intFromBool(slot != null);
+ try testing.expect(after > count);
+}