summaryrefslogtreecommitdiff
path: root/src/Kind.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 12:19:03 -0300
committerGabriel Schneider <[email protected]>2026-11-06 12:35:01 -0300
commite0ed81fc02b7fcf9f20f9be1c0080bd1339d80fb (patch)
treecd04bb0ab4d55cbb67f5c43b1898d640bce1fa22 /src/Kind.zig
parentf922f8b5db1f3b92d954c43860c32cd251d5bc55 (diff)
downloadpardes-e0ed81fc02b7fcf9f20f9be1c0080bd1339d80fb.tar.gz
pardes-e0ed81fc02b7fcf9f20f9be1c0080bd1339d80fb.zip
kinds #21, a PDF across replicas: a pane of a kind's frame crosses within the wire's bound (encodeShadow takes a budget and leaves out a raster past it, where a 17 MB page in a 110-column window ended every client's link and every join's after), a join's dump keeps a kind's tag words and selection (SlotRecord tail and selection, which only Kind.reopen made: a joiner's tag wrapped another way and it diverged on tag_rows at each join), and a speculation whose step would tick a kind waits for the session's unit (Kind.step's rule, read only) where it guessed no tick and rolled back, every visible rollback of the 30 ms soak cell
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/Kind.zig')
-rw-r--r--src/Kind.zig15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Kind.zig b/src/Kind.zig
index 2add017a..de5323bb 100644
--- a/src/Kind.zig
+++ b/src/Kind.zig
@@ -600,8 +600,11 @@ pub fn mouse(p: *Pardes, id: usize, m: pardes.Mouse, col: u16, row: u16) bool {
/// The end of a step: each pane of a kind whose focus changed, or whose
/// time has come, ticks (16.2).
pub fn step(p: *Pardes) void {
- if (tape.speculating()) return;
const now = p.clock.stepped_ns;
+ // A tick is the authority's kind's alone: a speculation whose step
+ // would tick one waits for the authority's unit (guessed untouched, the
+ // unit rolled it back, a visible rollback an input).
+ if (tape.speculating()) return if (wouldTick(p, now)) tape.poison("a kind's tick");
for (p.panes, 0..) |pslot, id| if (pslot) |pane| if (pane.addon) |slot| {
// Its tag laid out again by this step's sync, and drawn.
if (slot.retag) p.needs_frame = true;
@@ -629,6 +632,16 @@ pub fn step(p: *Pardes) void {
};
}
+/// 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| {
+ if (!caps(p, slot).tick) continue;
+ if (focusedAnywhere(p, id) != slot.focused or std.hash.Wyhash.hash(0, std.mem.asBytes(&viewOf(p, id))) != slot.view) return true;
+ if (slot.next_tick == 1 or (slot.next_tick > 1 and now >= slot.next_tick)) return true;
+ };
+ return false;
+}
+
/// Pane `id` as its next paint sees it: its body below its notices, as
/// draw.zig paints it, a cell's pixels, the theme's colours and the
/// raster this frontend wants a picture at.