diff options
Diffstat (limited to 'anim/src/rows.zig')
| -rw-r--r-- | anim/src/rows.zig | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/anim/src/rows.zig b/anim/src/rows.zig index 83064a6..1d097a1 100644 --- a/anim/src/rows.zig +++ b/anim/src/rows.zig @@ -125,8 +125,8 @@ pub fn chain(u: ui.Ui, x: f32, y: f32, moment: Recording.Moment, value: u64, roo if (link.string) { // What a pointer leads to, when it is text: quoted, cut to the room // there is (never under six characters), with `…` and no closing quote. - const fits: usize = @intFromFloat(@max((room - at - m.arrow_w) / adv, 0)); - if (fits < m.string_min + 2) break; + const fits: usize = @intFromFloat(std.math.clamp((room - at - m.arrow_w) / adv, 0, 4096)); + if (fits < @as(usize, @min(m.string_min, link.text.len)) + 2) break; at = v.arrow(at, mid, .holds); const whole = link.text.len + 2 <= fits; const text = if (whole) u.print("\"{s}\"", .{link.text}) else u.print("\"{s}\u{2026}", .{link.text[0 .. fits - 2]}); @@ -167,9 +167,10 @@ pub const flags = [_]Flag{ .{ .name = "CF", .bit = 0 }, .{ .name = "PF", .bit = /// code's ink and its name; never struck. At its right end the `flags`, /// eight names on a pitch of 42: set, upper case on a chip, bold, bright; /// clear, lower case, dim; changed, a turned corner (`changed`: a bit per -/// flag, and how much of the corner shows). The value of eflags is not -/// drawn: the names are the value. -pub fn rip(u: ui.Ui, y: f32, w: f32, moment: Recording.Moment, pc: u64, eflags: u64, changed: u64, held: f32, fire: f32) void { +/// flag, and how much of the corner shows); read, framed (`read`: a bit per +/// flag, while a conditional reads them: an echo of the row that set them, +/// `read_shows` how much). The value of eflags is not drawn: the names are the value. +pub fn rip(u: ui.Ui, y: f32, w: f32, moment: Recording.Moment, pc: u64, eflags: u64, changed: u64, held: f32, fire: f32, read: u64, read_shows: f32) void { const gold = theme.mark(.current); u.current(.{ .x = theme.stroke.rule, .y = y, .w = w - 2 * theme.stroke.rule, .h = row_h }, theme.metric.plaque.rip, fire); u.text(.mono_bold, size, m.side, baseline(y), "rip", gold.on_solid); @@ -183,6 +184,7 @@ pub fn rip(u: ui.Ui, y: f32, w: f32, moment: Recording.Moment, pc: u64, eflags: u.text(.mono_bold, size, x + 4, baseline(y), flag.name, t.bright); } else u.text(.mono, size, x + 4, baseline(y), u.print("{c}{c}", .{ std.ascii.toLower(flag.name[0]), std.ascii.toLower(flag.name[1]) }), ui.mix(t.dim, gold.ember, 0.2)); if (changed >> flag.bit & 1 != 0) u.corner(x, y + 2, m.corner, held); + if (read >> flag.bit & 1 != 0 and read_shows > 0) u.read(.{ .x = x, .y = y + 2, .w = fl.chip[0], .h = fl.chip[1] }, read_shows); x += fl.pitch; } } |
