summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/testing.zig7
-rw-r--r--src/ninep/tree.zig16
2 files changed, 18 insertions, 5 deletions
diff --git a/src/ninep/testing.zig b/src/ninep/testing.zig
index 44329eee..6ea40956 100644
--- a/src/ninep/testing.zig
+++ b/src/ninep/testing.zig
@@ -30,13 +30,10 @@ pub const Answer = struct {
};
pub fn call(p: *Pardes, req: Req) Answer {
- p.update(.{ .fs_req = req });
var ans: Answer = .{};
+ ans.reply = p.serveFs(req);
+ ans.bytes = p.fsPayload(ans.reply);
while (p.nextEffect()) |e| switch (e) {
- .fs_reply => |r| {
- ans.reply = r;
- ans.bytes = p.fsPayload(r);
- },
.save_file, .save_text => ans.saved = true,
.watch => |w| ans.watch = w.on,
.write => |w| {
diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig
index 5a0c1e11..b13b1472 100644
--- a/src/ninep/tree.zig
+++ b/src/ninep/tree.zig
@@ -68,6 +68,22 @@ pub const e_bad_event = "bad event syntax";
/// everywhere, as it is in acme (editors/acme/fsys.c, fsyscreate).
pub const features: cloud9.fs.Features = .{ .remove = true };
+/// Whether a request must wait until no step is out in a syscall
+/// (`pardes.turn`): what would change a pane such a step still points into.
+/// Making a pane and rendering a screen do not -- every yield sits before
+/// the mutation of its own step, so the layout and the surface are whole
+/// under it -- and a step out there is never waiting on a write of its own,
+/// so what parks here is never the syscall's own request.
+pub fn needsQuiet(req: Req) bool {
+ return switch (req.op) {
+ .write, .setattr => true,
+ .release => req.remove,
+ else => false,
+ };
+}
+
+/// `needsQuiet`, plus the open that makes a pane: what costs a frame and a
+/// wake of the editor.
pub fn changesPane(req: Req) bool {
return switch (req.op) {
.write, .setattr => true,