summaryrefslogtreecommitdiff
path: root/src/ninep/tree.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/tree.zig')
-rw-r--r--src/ninep/tree.zig8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig
index c71a706f..cc8f938a 100644
--- a/src/ninep/tree.zig
+++ b/src/ninep/tree.zig
@@ -843,7 +843,8 @@ fn open(p: *Pardes, req: Req, target: Target) Reply {
const reader = req.omode & 3 != 1; // OWRITE is the one mode that never reads
break :what switch (t.file) {
.body => if (pn.isTerminal()) .{ .snapshot = null } else if (req.omode & 3 == 0) return .{ .tag = req.tag } else .writes,
- .data, .xdata => if (req.omode & 3 != 0) .writes else return .{ .tag = req.tag },
+ // sel too: one open's writes run on from its last (wrsel).
+ .data, .xdata, .sel => if (req.omode & 3 != 0) .writes else return .{ .tag = req.tag },
// Reads of these consume, so two readers would each see half
// the stream; the second is refused rather than robbed.
.event => if (reader and pn.fs.event_reader) return failText(req.tag, E.BUSY, e_in_use) else .{ .event = reader },
@@ -932,6 +933,11 @@ fn releaseHandle(p: *Pardes, req: Req) void {
};
// The writes of one open are one undo step (pane.zig `joined`): its
// close ends that step.
+ // A sel open's run of writes ends with it.
+ if (t == .pane and t.pane.file == .sel) if (p.paneBySerial(t.pane.serial)) |id| {
+ const pf = &p.panes[id].?.fs;
+ if (pf.wrsel_by == req.handle) pf.wrsel_by = 0;
+ };
if (t == .pane and (t.pane.file == .body or t.pane.file == .data or t.pane.file == .xdata)) if (p.paneBySerial(t.pane.serial)) |id| {
const pf = &p.panes[id].?.fs;
if (pf.joined_by == 0 or pf.joined_by == req.handle) pf.joined = null;