From 9991a90aae7f4591e63e5ecb0ab2467a348ed54e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 13:18:42 -0300 Subject: kinds #22, a kind's frame as its tick left it: a step that ticks a kind paints it once for the live view (Kind.repaint) before its tag is laid out, where the tag took what the frame before the tick placed and the next input's step another (a replica's guess of that input, the last step's tag, missed: 13 of the 30 ms cell's 14 visible rollbacks), so a pane of a kind's tag has its art words from its first step (the fake and pdf addon scripts' windows a row shorter), and an input's step sends each client what it made of a kind's pane after its unit, not at the next pump (a terminal client looked at the frame from before its own key's tick, the text layer missing from its view) Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/Kind.zig | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/Kind.zig') diff --git a/src/Kind.zig b/src/Kind.zig index de5323bb..66e37852 100644 --- a/src/Kind.zig +++ b/src/Kind.zig @@ -629,9 +629,30 @@ pub fn step(p: *Pardes) void { if (slot.ops) |o| cl.ret = @bitCast(o.tick.?(slot.st, now, flags)); slot.next_tick = @bitCast(cl.end(prev).ret); p.needs_frame = true; + repaint(p, slot, id); }; } +/// Its prefix and whether it places a picture as its tick left it, for +/// this step's tag: a frame's paint set them, a step behind the tick (a +/// PDF to its text layer, or back), and a replica guessing its next input +/// took the tag this step laid out. The live view's frame of it, painted +/// and let go; not a frame drawn (`painted` kept). +fn repaint(p: *Pardes, slot: *Slot, id: usize) void { + const pane = p.panes[id] orelse return; + if (slot.ops == null or pane.collapsed) return; + const r = p.view().rects[id]; + const cols = r.w -| pardes.config.GUTTER; + const rows = (r.h -| pane.tag_rows) -| pane.notices.span(); + if (cols == 0 or rows == 0) return; + const drawn = slot.painted; + defer slot.painted = drawn; + var arena: std.heap.ArenaAllocator = .init(slot.gpa); + defer arena.deinit(); + var frame: Frame = .{ .cols = cols, .rows = rows }; + _ = paint(p, slot, id, arena.allocator(), cols, rows, &frame); +} + /// Whether `step` would tick some pane of a kind now (its rule, read only). fn wouldTick(p: *const Pardes, now: u64) bool { for (p.panes, 0..) |pslot, id| if (pslot) |pane| if (pane.addon) |slot| { -- cgit v1.3