summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 04:53:03 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commitcdf4cbbf1fdd121aabdbbea33f11d5ee44d7764e (patch)
treee41e7f031d7ccc932ad2ed4ddb4f285dc767b63c /src
parent430d482c16101ce85b5c0f80f6bdd882c09a3272 (diff)
downloadpardes-cdf4cbbf1fdd121aabdbbea33f11d5ee44d7764e.tar.gz
pardes-cdf4cbbf1fdd121aabdbbea33f11d5ee44d7764e.zip
A look written back from an event sets what look reads back
A look an event reader wrote back ran, but /look still read the last look made through it. It now answers the pane the written-back look found, as a look written there would. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/ninep/events.zig16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/ninep/events.zig b/src/ninep/events.zig
index d75c399b..a3f8c278 100644
--- a/src/ninep/events.zig
+++ b/src/ninep/events.zig
@@ -622,7 +622,17 @@ pub fn writeEvent(p: *Pardes, req: Req, id: usize) Reply {
};
},
.tag_exec => _ = exec.execute(p, live, text),
- .body_look, .tag_look => look.lookAt(p, live, text),
+ // What it found is what the look file reads back next, as a
+ // look written there would leave (ctl.run).
+ .body_look, .tag_look => {
+ p.look_missed = false;
+ look.lookAt(p, live, text);
+ p.fs.results_len = 0;
+ if (!p.look_missed) if (p.panes[p.active]) |found| {
+ p.fs.results[0] = found.serial;
+ p.fs.results_len = 1;
+ };
+ },
else => unreachable,
}
}
@@ -839,6 +849,10 @@ test "writing an event record back performs the action it names" {
try testing.expectEqual(E.INVAL, wr(p, event, bad).errno());
try testing.expectEqual(@as(usize, 0), pane.msg_len);
}
+ // A look written back sets what look reads back.
+ _ = wr(p, event, "FL0 3\n");
+ var want_serial: [16]u8 = undefined;
+ try testing.expectEqualStrings(try std.fmt.bufPrint(&want_serial, "{d}\n", .{serial}), rd(p, @intFromEnum(tree.TopFile.look), 0, 64).bytes);
// Well formed but past the text: said so, not "bad event syntax".
try testing.expectEqualStrings("range past end of body", wr(p, event, "MX0 999\n").reply.ename);