diff options
Diffstat (limited to 'src/Kind.zig')
| -rw-r--r-- | src/Kind.zig | 21 |
1 files changed, 21 insertions, 0 deletions
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| { |
