summaryrefslogtreecommitdiff
path: root/src/ninep/pane.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/pane.zig')
-rw-r--r--src/ninep/pane.zig8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig
index 42c0c48e..4b34cf96 100644
--- a/src/ninep/pane.zig
+++ b/src/ninep/pane.zig
@@ -24,6 +24,12 @@ const Node = tree.Node;
/// Filesystem state a pane carries beside its editor state.
pub const State = struct {
+ /// The range `data` and `xdata` read and write through. acme clears it
+ /// when the first client opens `addr` (editors/acme/xfid.c:105), which
+ /// suits a client that holds the fid open and leaves a shell reading back
+ /// `0 0` from the address it just wrote. Here it is the pane's own
+ /// register, cleared by truncating the file, so that `cp addr dot` and
+ /// `cat addr` answer what was written.
addr: Range = .{},
limit: ?Range = null,
readers: u16 = 0,
@@ -458,7 +464,7 @@ fn writeRange(p: *Pardes, req: Req, id: usize, pane: *Pane, file: PaneFile) Repl
const pf = &p.fs.panes[id];
const text = bodyOf(pane);
clampAddr(pf, text.len);
- const r = rangeOf(pf, text, req.data) orelse return Reply.fail(req.tag, E.INVAL);
+ const r = rangeOf(pf, text, req.data) orelse return tree.failText(req.tag, E.INVAL, tree.e_bad_addr);
switch (file) {
.addr => pf.addr = r,
.limit => pf.limit = r,