summaryrefslogtreecommitdiff
path: root/core/ninep/tree.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-21 07:02:01 -0300
committerGabriel Schneider <[email protected]>2026-11-21 07:02:01 -0300
commitf7de6f49ee3d9ac241575f5244743193c9943841 (patch)
tree9f77af1eab8bfba6a4c8cfc75fe5ec646d517ffe /core/ninep/tree.zig
parent78a022adb2a657711f706fcaae7c2abb412dac9c (diff)
downloadpardes-f7de6f49ee3d9ac241575f5244743193c9943841.tar.gz
pardes-f7de6f49ee3d9ac241575f5244743193c9943841.zip
layers: what round 1 left, three places where a revision's pane or a patch's did not do what the design's words say: a B3 click on path@rev[:line] in running text opens the file at that revision there (the click already expanded the whole token, @ being a file character; jj's test now drives it through the mouse); a revision's text is read-only over 9P too: an open of its body, data, xdata or sel to write is refused in words ("a revision is read-only", errno EROFS, as enameErrno reads the words: core/ninep/tree.zig's open, the one road 9P has to the text; the editor's own two are File.edit's splice and edit.zig's whole text), where before the write reached File.edit and was answered "out of memory"; Syntax off in a patch's pane takes the language's ink and leaves the patch: its bytes are made again once a paint without the language's (syntax.highlightDiffPlain), grounds, markers and changed words as they were (round 1 took them too); tests: the click, the four opens, a .zig patch's cells' grounds the same and its ink not; tui core-test 893/1053 (160 skipped)
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/ninep/tree.zig')
-rw-r--r--core/ninep/tree.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/ninep/tree.zig b/core/ninep/tree.zig
index 2c0ce1b0..01cfe297 100644
--- a/core/ninep/tree.zig
+++ b/core/ninep/tree.zig
@@ -57,6 +57,10 @@ pub fn failText(tag: u64, errno: u16, text: []const u8) Reply {
}
pub const e_bad_ctl = "ill-formed control message";
+/// A revision's text refused a write (cloud9's E has no EROFS; its words
+/// map back to it: enameErrno).
+pub const e_revision = "a revision is read-only";
+const rofs: u16 = 30;
pub const e_bad_event = "bad event syntax";
/// A second open reading a file whose reads consume: rio's word for it
/// (windows/rio/xfid.c:25), which 9ns turns into EBUSY.
@@ -933,6 +937,10 @@ fn open(p: *Pardes, req: Req, target: Target) Reply {
const pn = p.panes[p.paneBySerial(t.serial) orelse return Reply.fail(req.tag, E.NOENT)].?;
if (t.file.inPty() and !pn.isTerminal()) return Reply.fail(req.tag, E.NOENT);
pane_of = pn;
+ // A file at a revision is read-only (jj.zig): no open writes its
+ // text, the one road 9P has to it.
+ if (req.omode & 3 != 0 and (t.file == .body or t.file == .data or t.file == .xdata or t.file == .sel))
+ if (pn.file) |*f| if (@import("../jj.zig").of(f) != null) return failText(req.tag, rofs, e_revision);
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,