diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-27 17:41:55 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | 542dd489149e33915d19878a277e23b3a9c0b070 (patch) | |
| tree | aeb557581446621c366a2d3cd5888d25b37c5916 /src/fs.zig | |
| parent | c11ffe24f022d61cdd479e1ee946033c42e9a08c (diff) | |
| download | pardes-542dd489149e33915d19878a277e23b3a9c0b070.tar.gz pardes-542dd489149e33915d19878a277e23b3a9c0b070.zip | |
Record /log whether or not anyone reads it, with the editor's messages in it
/log is now one ring (64 KiB, 4 KiB on the board) that records new, del,
rename and save, and a msg line for everything the editor says. An open
freezes it, so cat log shows what happened lately and ends; writing
follow to that same open makes reads past it wait for newer records, and
a follower the ring outran reads lost N first.
The message log keeps the pane's serial, not its reusable slot.
A test now fails when the tree serves a file /README never mentions; it
caught pty/status, now documented along with typing through pty/data.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/fs.zig')
| -rw-r--r-- | src/fs.zig | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -308,8 +308,10 @@ test "virtual writes enforce permissions even when contents are empty" { const p = try pardes.Pardes.init(std.testing.allocator, .{ .tty_only = true }); defer p.deinit(); for ([_][]const u8{ "", "bytes" }) |bytes| { - for ([_][]const u8{ "/virtual/index", "/virtual/screen", "/virtual/README", "/n/self/log" }) |path| + for ([_][]const u8{ "/virtual/index", "/virtual/screen", "/virtual/README" }) |path| try std.testing.expectError(error.ReadOnlyFilesystem, write(p, path, bytes)); + // /log takes one word, `follow`, and only on the open it changes. + if (bytes.len > 0) if (write(p, "/n/self/log", bytes)) |_| return error.TestUnexpectedResult else |_| {}; try std.testing.expectError(error.IsDirectory, write(p, "/virtual/pane", bytes)); try std.testing.expectError(error.FileNotFound, write(p, "/virtual/missing", bytes)); try std.testing.expectError(error.FileNotFound, write(p, "/virtual/cons", bytes)); @@ -1240,9 +1242,9 @@ pub const Namespace = struct { panes: [MAX_PANES]tree.pane.State = @splat(.{}), listeners: u16 = 0, origin: u8 = 'K', - /// The editor-wide event stream, recorded only while /log is held open. - log: tree.events.Queue = .{}, - log_readers: u16 = 0, + /// The editor-wide event ring: panes made, renamed, saved and closed, and + /// what the editor said. Recorded whether or not anyone reads /log. + log: tree.events.Queue = .{ .cap = limits.log_bytes }, /// What the last look or exec created or touched, answered by reading /// either of those files. results: [MAX_PANES]u32 = undefined, |
