From 232bfbbc4371a1fe9df210874118b4450dce7f9d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 00:30:46 -0300 Subject: 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 --- src/Messages.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Messages.zig') 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| { -- cgit v1.3