diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 00:30:46 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | 232bfbbc4371a1fe9df210874118b4450dce7f9d (patch) | |
| tree | 6af9cfcc6e741082b15a270a6d80d3d182301ce5 /src/Messages.zig | |
| parent | 42748f92b77367db415c8b4d0f2e537a9e1ddde7 (diff) | |
| download | pardes-232bfbbc4371a1fe9df210874118b4450dce7f9d.tar.gz pardes-232bfbbc4371a1fe9df210874118b4450dce7f9d.zip | |
Let a pane's tag take a row for each line it holds
A tag that is a text can hold a newline, and the tagline, the body under it
and the pointer all assumed one row. The pane's tag now takes a row per line
(up to eight, and never the body's last row); the body starts below it, the
rows a pointer counts start the body after the tag's lines, a click on any
line puts the tag's cursor there, and a pixel shell gets a tag layer per
line. A tag of one line draws exactly as before.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/Messages.zig')
| -rw-r--r-- | src/Messages.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Messages.zig b/src/Messages.zig index 053950da..c7ff09be 100644 --- a/src/Messages.zig +++ b/src/Messages.zig @@ -397,7 +397,7 @@ pub fn reportError(p: *Pardes, id: usize, operation: []const u8, err: anyerror) /// them instead of letting the last one win the row. pub fn collectNotices(p: *Pardes, pane: *Pane, r: Rect, id: usize) void { pane.notices.len = 0; - if (r.w <= config.GUTTER or r.h <= BOX_H) return; + if (r.w <= config.GUTTER or r.h <= pane.tag_rows) return; // Oldest message line on top, so lines already up do not move when a // new one lands under them; when rows run out the oldest go first. for (pane.msg_older[0..pane.msg_older_len], 0..) |line, i| pane.notices.pushAt(.older, @intCast(i), line.slot); @@ -409,7 +409,7 @@ pub fn collectNotices(p: *Pardes, pane: *Pane, r: Rect, id: usize) void { // carrying the cursor: a prompt you cannot see is a prompt you type // into blind. A two-row pane spends its only body row on one notice, // which is what the single shared row used to do anyway. - const room: u8 = @intCast(@min(@as(u16, Pane.Notices.max), r.h - BOX_H)); + const room: u8 = @intCast(@min(@as(u16, Pane.Notices.max), r.h - pane.tag_rows)); const n = &pane.notices; if (n.span() <= room) return; // Too short for the gaps: close them up in screen order, and if even @@ -743,7 +743,7 @@ test "notices stack over the body's top rows without moving them" { defer frame.deinit(); const r = p.rects[id]; - const top = p.bodyTop(r); + const top = p.bodyTop(pane, r); // A message and a leader prefix at once: two chips, in the order // collectNotices chose, each one row tall and each one row further down. @@ -754,7 +754,7 @@ test "notices stack over the body's top rows without moving them" { _ = try p.render(frame.allocator()); try std.testing.expectEqual(@as(u8, 2), pane.notices.len); // An overlay, not a reservation: the body still starts where it did. - try std.testing.expectEqual(top, p.bodyTop(r)); + try std.testing.expectEqual(top, p.bodyTop(pane, r)); var seen: usize = 0; for (p.surface.tagLayers()) |*layer| { |
