From 4793520998969439bb569c968c3143ae46aefc66 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 22:17:49 -0300 Subject: A pane's question is logged as ask, and answer on its ctl answers it A script could not answer the several-REPLs question, which only a key could. Every question a pane asks on its notice band (which REPL takes an exec, Del's side from the keyboard) is now logged as `ask `, and `answer ` on the pane's ctl answers it as that key would, `answer -` taking it back as Esc does. One function answers for a key and for the ctl. Co-Authored-By: Claude Opus 5.5 --- src/ninep/testing.zig | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/ninep/testing.zig') diff --git a/src/ninep/testing.zig b/src/ninep/testing.zig index fce77f10..927552e2 100644 --- a/src/ninep/testing.zig +++ b/src/ninep/testing.zig @@ -56,6 +56,15 @@ pub fn rd(p: *Pardes, node: u64, off: u64, size: u32) Answer { return call(p, .{ .tag = 1, .op = .read, .node = node, .off = off, .size = size }); } +/// Whether the log, read whole from a fresh open, holds `needle`. +pub fn logHas(p: *Pardes, needle: []const u8) bool { + const log = @intFromEnum(tree.TopFile.log); + const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; + defer _ = call(p, .{ .tag = 3, .op = .release, .node = log, .handle = h }); + const text = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes; + return std.mem.indexOf(u8, text, needle) != null; +} + pub fn wr(p: *Pardes, node: u64, data: []const u8) Answer { return call(p, .{ .tag = 2, .op = .write, .node = node, .data = data }); } -- cgit v1.3