summaryrefslogtreecommitdiff
path: root/src/ninep/tree.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 00:35:08 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commitd7b3d57ed0ba649f01559356fbf2bf89561990ca (patch)
tree37c95f8c04fd86961197a54adbb920675034d98a /src/ninep/tree.zig
parent218d574b59abd7fb8dd6fe027b12927fc31c3506 (diff)
downloadpardes-d7b3d57ed0ba649f01559356fbf2bf89561990ca.tar.gz
pardes-d7b3d57ed0ba649f01559356fbf2bf89561990ca.zip
rows: a pane's rows from outside, one definition and two sinks: File.setRows is the one writer of a pane's rows (locations.Row, the stored form as it was: digest, dump and blobs unchanged), refusing what its text cannot hold (more rows than lines, an offset or styles past a line's end) and keeping the painting of equal rows; Output.fillRows keeps what is the editor's (the pane, its refill identity, the steps) and hands its rows to it, as the query panes' three writers do; locations.formatRows and parseRows are its text, a line a row, fields a blank apart and the path last (kind m c p with d and u, line col end_line end_col source_column location_end code_start, styles as `-` or `N:start+len=role,...` a role a syntax class and grounds joined by dots); each pane directory over 9P has `rows`, read as that text (+Search's, +Callstack's addresses as data) and written whole lines at a time, at 0 replacing and later following (a line cut by a mount waits for its open's next write; tree.writeLines passes a line on at the offset it was begun at), `>` emptying them; tests: the rows of a +Search, a +Callstack and a +Diff read back from their text equal, byte for byte, and the file read, written whole and across writes, refused and emptied; README, reference and changelog say so
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/ninep/tree.zig')
-rw-r--r--src/ninep/tree.zig14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig
index bca89466..e0cb69b5 100644
--- a/src/ninep/tree.zig
+++ b/src/ninep/tree.zig
@@ -313,6 +313,9 @@ pub const PaneFile = enum(u5) {
/// A word run as a click in the pane's tag, as /tagexec is in the
/// workspace's and col/<n>/exec in a column's.
tagexec,
+ /// A line a body row: where it points and how it is coloured
+ /// (locations.formatRows), a results pane's; written, the pane's.
+ rows,
pty,
pty_ctl,
pty_status,
@@ -1163,7 +1166,7 @@ fn linesFile(target: Target) bool {
.col => |c| c.file == .ctl or c.file == .exec,
// `name` too: one name, however its writes cut it, applied once
// its newline comes, or with its write when that is whole.
- .pane => |t| t.file == .look or t.file == .exec or t.file == .ctl or t.file == .tagexec or t.file == .name,
+ .pane => |t| t.file == .look or t.file == .exec or t.file == .ctl or t.file == .tagexec or t.file == .name or t.file == .rows,
};
}
@@ -1326,6 +1329,9 @@ fn writeLines(p: *Pardes, req: Req, target: Target) Reply {
o.pending.shrinkRetainingCapacity(rest);
var w = req;
w.data = whole;
+ // At the offset its first byte was written at, an earlier write's
+ // held line included (a rows write at 0 starts the rows over).
+ w.off = (req.off + (req.data.len - data.len)) -| (end + rest - data.len);
// The command pane this open was answered holds no lease against its
// own next command (exec.leased): that one may run there again.
if (resultsFile(target)) o.results.len = 0;
@@ -1611,10 +1617,10 @@ test "readdir lists the root and a pane directory without creating anything" {
const dir = rdir(p, Node.of(serial, .dir), 0);
const files = th.dirents(dir.bytes, &buf);
- try testing.expectEqual(@as(usize, 18), files.len);
+ try testing.expectEqual(@as(usize, 19), files.len);
for ([_][]const u8{
- "name", "body", "tag", "ctl", "addr", "dot", "limit", "data", "xdata",
- "sel", "dirty", "mark", "scroll", "errors", "event", "look", "exec", "tagexec",
+ "name", "body", "tag", "ctl", "addr", "dot", "limit", "data", "xdata", "sel",
+ "dirty", "mark", "scroll", "errors", "event", "look", "exec", "tagexec", "rows",
}, 0..) |name, i|
try testing.expectEqualStrings(name, files[i].name);
try testing.expect(th.nameAt(files, ".") == null);