diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-27 20:14:04 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | acd9e032a147f4aa7ad49110dc2f4fb945e7a9bb (patch) | |
| tree | 6b81d7ac0b759472bd5c1afb1fc15cd6c930ac79 /src/fs.zig | |
| parent | 28c814aa5cfea23e8950ef007916ffc5d089288d (diff) | |
| download | pardes-acd9e032a147f4aa7ad49110dc2f4fb945e7a9bb.tar.gz pardes-acd9e032a147f4aa7ad49110dc2f4fb945e7a9bb.zip | |
Keep a pane's filesystem state on the Pane instead of a slot-indexed table
addr, limit, the event queue and its readers, pty/data's queue, a waiting
run and the /log announcement flag lived in p.fs.panes[slot], reset when
the pane went; a reused slot is how the bug class came in. acme keeps the
same state on its Window (editors/acme/dat.h:226-266), so now Pane.fs
holds it: announced, retired (noteRetire, which still answers a waiting
run and drops the listener count first) and freed with the pane itself.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/fs.zig')
| -rw-r--r-- | src/fs.zig | 14 |
1 files changed, 1 insertions, 13 deletions
@@ -586,7 +586,7 @@ test "virtual body writes can read their input from the same pane" { try write(p, path, pane.file.?.content); try std.testing.expectEqualStrings("same pane contents\n", pane.file.?.content); try std.testing.expectEqual(@as(usize, 2), pane.file.?.history.undo_len); - const events = &p.fs.panes[p.active].events; + const events = &p.panes[p.active].?.fs.events; try std.testing.expect(std.mem.startsWith(u8, events.peek().?, "ED")); events.pop(); try std.testing.expect(std.mem.startsWith(u8, events.peek().?, "EI")); @@ -1240,7 +1240,6 @@ pub const Namespace = struct { snapshots: [tree.screen.snapshot_slots]tree.screen.Snapshot = @splat(.{}), runs: [tree.pty.run_slots]tree.pty.Run = @splat(.{}), out: std.ArrayList(u8) = .empty, - panes: [MAX_PANES]tree.pane.State = @splat(.{}), listeners: u16 = 0, origin: u8 = 'K', /// Reads that found nothing yet, one per open that can wait: the log's @@ -1269,7 +1268,6 @@ pub const Namespace = struct { st.os_paths.deinit(gpa); for (st.snapshots) |snapshot| if (snapshot.bytes) |bytes| gpa.free(bytes); for (&st.runs) |*slot| slot.reset(gpa, 0); - for (&st.panes) |*pf| pf.deinit(gpa); st.log.deinit(gpa); st.out.deinit(gpa); } @@ -1292,16 +1290,6 @@ pub const Namespace = struct { st.out.ensureTotalCapacity(gpa, tree.out_reserve) catch {}; return &st.out; } - - pub fn forget(st: *Namespace, gpa: std.mem.Allocator, id: usize) void { - if (id >= MAX_PANES) return; - st.listeners -= @min(st.listeners, st.panes[id].readers); - st.panes[id].deinit(gpa); - } - - pub fn scripted(st: *const Namespace, id: usize) bool { - return id < MAX_PANES and st.panes[id].readers != 0; - } }; pub fn unmount(p: *Pardes, name: []const u8) !void { |
