summaryrefslogtreecommitdiff
path: root/core/edit.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/edit.zig')
-rw-r--r--core/edit.zig11
1 files changed, 8 insertions, 3 deletions
diff --git a/core/edit.zig b/core/edit.zig
index 129b004c..70b765cc 100644
--- a/core/edit.zig
+++ b/core/edit.zig
@@ -427,8 +427,13 @@ pub var drawing = false;
/// A terminal's rows as text (`Term.rows`), kept for one pane until its
/// grid moves. Returned slices remain valid until the next cache rebuild
-/// or reset.
+/// or reset. A replica's rollback copy holds it as any state: its text and
+/// rows are made whole and freed whole, never written, so the copy pins
+/// them (blobs, freed raw) and puts the cache back with the core: no
+/// emulator is written while a copy is held (replica.zig `confirm`: a unit
+/// that writes one lets the copy go or is applied after it is put back).
pub const RowsCache = struct {
+ pub const replica = .{ .blob = .{ "text", "rows", "text_alloc" } };
/// whose grid this describes; null = the slot is free
pane: ?*const Pane = null,
/// the rows joined by '\n' — `flatSurface` hands this back verbatim
@@ -442,8 +447,8 @@ pub const RowsCache = struct {
stale: bool = false,
pub fn reset(c: *RowsCache, gpa: std.mem.Allocator) void {
- if (c.text_alloc.len > 0) gpa.free(c.text_alloc);
- if (c.rows.len > 0) gpa.free(c.rows);
+ pardes.memory.freeRaw(gpa, c.text_alloc);
+ pardes.memory.freeRaw(gpa, c.rows);
c.* = .{};
}