summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Kind.zig21
-rw-r--r--src/replica.zig4
2 files changed, 25 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| {
diff --git a/src/replica.zig b/src/replica.zig
index c5e3fd34..e3deff40 100644
--- a/src/replica.zig
+++ b/src/replica.zig
@@ -1911,6 +1911,10 @@ pub const Peers = struct {
ps.t.stamp = null;
ps.screensOut(core, .fill);
ps.unit(peer.id, in.seq);
+ // What the step made of a kind's pane (its tick: another layout,
+ // the text layer) goes now, not at the next pump's: one may not
+ // come before the client looks.
+ ps.screensOut(core, .flush);
}
const ScreensOut = enum { flush, fill };