summaryrefslogtreecommitdiff
path: root/src/ninep/tree.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 01:29:25 -0300
committerGabriel Schneider <[email protected]>2026-10-01 01:35:12 -0300
commit0bc1ca8f9d3ece476ac469fc0a180793aab412df (patch)
treeb01e02c7ff96be098a2b1543e6069836ef669fa5 /src/ninep/tree.zig
parentb3bbad85c61f81c01fb983813ccc28ceb6361469 (diff)
downloadpardes-0bc1ca8f9d3ece476ac469fc0a180793aab412df.tar.gz
pardes-0bc1ca8f9d3ece476ac469fc0a180793aab412df.zip
A write to sel leaves the text it wrote selected, as acme's wrsel does, so cat sel reads it back; one open's writes run on from the last
The selection collapsed to a point after the write, so sel read back nothing. What is written is now dot, and the next write of the same open goes at its end and grows it (acme's wrselrange), so a shell's several writes make one selection; another open's write replaces it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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;