diff options
Diffstat (limited to 'src/dump.zig')
| -rw-r--r-- | src/dump.zig | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/dump.zig b/src/dump.zig index c5e2953b..102b10d0 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -774,6 +774,8 @@ const SlotRecord = struct { focused: bool = false, /// The jobs whose answers it dropped (api.cancel): a replica's drop them too. cancelled: [4]u32 = @splat(0), + /// Its last job's token (Kind.Slot.tokens): a client's next is the session's. + tokens: u32 = 0, /// Its tick's prefix: a replica's tag laid out as the session's. prefix: []const u8 = "", /// A placeholder's why (its file not here). @@ -793,7 +795,7 @@ const SlotRecord = struct { pub fn slotWrite(s: *const Kind.Slot, gpa: std.mem.Allocator, w: *std.Io.Writer) !void { var place: [32]u8 = undefined; - var r: SlotRecord = .{ .name = s.nameOf(), .version = s.version, .gen = s.gen, .path = s.path, .art = s.art, .record = s.record, .where = s.where_text.slice(), .values = s.values.slice(), .live = s.live, .next_tick = s.next_tick, .views = s.views, .focused = s.focused, .cancelled = s.cancelled, .prefix = s.prefix.slice(), .refused = s.refused.slice(), .tail = s.tail.slice(), .selection = s.selection, .state = s.state }; + var r: SlotRecord = .{ .name = s.nameOf(), .version = s.version, .gen = s.gen, .path = s.path, .art = s.art, .record = s.record, .where = s.where_text.slice(), .values = s.values.slice(), .live = s.live, .next_tick = s.next_tick, .views = s.views, .focused = s.focused, .cancelled = s.cancelled, .tokens = s.tokens, .prefix = s.prefix.slice(), .refused = s.refused.slice(), .tail = s.tail.slice(), .selection = s.selection, .state = s.state }; var owned: ?[]u8 = null; defer if (owned) |o| s.gpa.free(o); if (s.ops != null) { @@ -835,7 +837,7 @@ pub fn slotRead(out: *Kind.Slot, gpa: std.mem.Allocator, bytes: []const u8) !voi var arena: std.heap.ArenaAllocator = .init(gpa); defer arena.deinit(); const r = try walk.load(SlotRecord, arena.allocator(), bytes, null); - out.* = .{ .gpa = gpa, .arena = .init(gpa), .version = r.version, .gen = r.gen, .art = r.art, .live = r.live, .next_tick = r.next_tick, .views = r.views, .focused = r.focused, .cancelled = r.cancelled, .state = r.state }; + out.* = .{ .gpa = gpa, .arena = .init(gpa), .version = r.version, .gen = r.gen, .art = r.art, .live = r.live, .next_tick = r.next_tick, .views = r.views, .focused = r.focused, .cancelled = r.cancelled, .tokens = r.tokens, .state = r.state }; errdefer out.free(); @memcpy(out.name[0..@min(15, r.name.len)], r.name[0..@min(15, r.name.len)]); out.path = try gpa.dupe(u8, r.path); @@ -899,7 +901,8 @@ pub fn plainHere(p: *Pardes, id: usize, old: *Kind.Slot, ops: *const Kind.Ops) ! } s.path = try p.gpa.dupe(u8, old.path); s.selection = try p.gpa.dupe(u8, old.selection); - const kept = .{ old.next_tick, old.views, old.focused, old.state }; + // (and its place: the open's own `where` is of a block not yet the session's) + const kept = .{ old.next_tick, old.views, old.focused, old.state, old.where_text }; if (!Kind.reopen(p, id, s, old.file)) return error.KindRefused; // Its block the session's, byte for byte (its record), never through // the kind's load, which may tidy it. @@ -907,7 +910,7 @@ pub fn plainHere(p: *Pardes, id: usize, old: *Kind.Slot, ops: *const Kind.Ops) ! const record = old.record orelse return error.KindRefused; if (block.len != record.len) return error.KindRefused; @memcpy(block, record); - s.next_tick, s.views, s.focused, s.state = kept; + s.next_tick, s.views, s.focused, s.state, s.where_text = kept; const gpa = old.gpa; old.free(); gpa.destroy(old); |
