summaryrefslogtreecommitdiff
path: root/core/draw.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-25 07:03:02 -0300
committerGabriel Schneider <[email protected]>2026-11-25 07:03:03 -0300
commiteb8ecb8a451ae32d590c42755614b801f9cc0c09 (patch)
tree0ea2f19acf06694ed744061b6ba41541ab0f2ae9 /core/draw.zig
parent6068e48aa4cec242dc0c29865b06347573fdd1ae (diff)
downloadpardes-eb8ecb8a451ae32d590c42755614b801f9cc0c09.tar.gz
pardes-eb8ecb8a451ae32d590c42755614b801f9cc0c09.zip
views, dump, draw: a load makes each view's band rows again from its own tag state, and the tag's own rows are held to MAX_TAG_ROWS where the frame reads them (the coordinator's item from P3's soak: `index out of bounds: index 15, len 8` at draw.zig paintPaneTag, `for (lines[0..rows])`, from views.drawOne in a replica client's draw after a divergence); RUN FIRST: views.zig's new test on the parent, its band-rows check left out: `panic: index out of bounds: index 12, len 8` at draw.zig:1007 paintPaneTag, from joinPaneTag, renderPane, render, drawOne: the same fault; THE CAUSE: a tag's `tag_rows` counts its band's rows (Core.sync: the band unrolled under its text pushes the body down) and is dumped and in the digest, while `band_rows` is derived (views.PaneView and Pane: never dumped, made again at every sync); a load (a join's dump, a replica's rollback) zeroed `band_rows` and kept `tag_rows`, so a view drawn before its next step (drawOne: a replica client's own view, a pump's other views; no sync there) read the tag's own rows as `tag_rows - band_rows` = the band's too, 12 to 19, and indexed paintPaneTag's `[MAX_TAG_ROWS]` array past its 8; THE FIX: views.bandsLoaded (from dump.afterLoad, after TagState.loaded) makes each open view's `band_rows` again within that view from its own state as its sync does (`Band.takes`, 0 for a folded pane and Band.over's), into the pane's live field and the view's share (derived: the digest is unchanged, as the test checks); draw.joinPaneTag and paintPaneTag hold the tag's own rows to MAX_TAG_ROWS (`-|` and `@min`): production code never panics on a stale pair; TEST: views.zig "a view not live with its band open, dumped and loaded, draws before its next step: its band's rows made again from its state, its tag's rows never past MAX_TAG_ROWS" (SPC Down in view 0, another view live, byteDump, load: the digest equal, view 0's share's band rows 11 again (0 on the parent), drawOne draws it; with its band rows zeroed by hand drawOne draws it too); a user's client could abort on a join or a rollback while another view had a band open; core-test 1073/1244 (171 skipped)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/draw.zig')
-rw-r--r--core/draw.zig7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/draw.zig b/core/draw.zig
index 28b9f22d..2ef72f0e 100644
--- a/core/draw.zig
+++ b/core/draw.zig
@@ -822,8 +822,9 @@ fn joinPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r
const chrome = p.chromeTheme();
const region = s.region(.tag, id).?;
const tag = (try tagline.shownTag(p, arena, pane)).text;
- // The tag's text rows; the band's under them are its own layer.
- const rows = pane.tag_rows - pane.band_rows;
+ // The tag's text rows; the band's under them are its own layer. A
+ // tag's own are MAX_TAG_ROWS at most (Pardes.sync).
+ const rows = @min(pane.tag_rows -| pane.band_rows, MAX_TAG_ROWS);
// As wide as the widest row it shows, and never narrower than its
// viewport.
var widest: usize = 0;
@@ -978,7 +979,7 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane,
const tx = r.x + @min(TAG_TEXT_INSET, r.w);
const tw = r.w -| TAG_TEXT_INSET;
const tag_y = p.tagTop(pane, r);
- const rows = pane.tag_rows - pane.band_rows;
+ const rows = @min(pane.tag_rows -| pane.band_rows, MAX_TAG_ROWS);
const page_rgb = th.bg orelse th.tag_bg;
// Focus is visible along the tag without changing its live text grid.
const tag_bg = tagGround(p, pane, active);