summaryrefslogtreecommitdiff
path: root/anim/src/rows.zig
diff options
context:
space:
mode:
Diffstat (limited to 'anim/src/rows.zig')
-rw-r--r--anim/src/rows.zig22
1 files changed, 20 insertions, 2 deletions
diff --git a/anim/src/rows.zig b/anim/src/rows.zig
index 95400be..f82bb81 100644
--- a/anim/src/rows.zig
+++ b/anim/src/rows.zig
@@ -356,7 +356,8 @@ pub fn callLabels(u: ui.Ui, y: f32, w: f32, n: usize, name: []const u8, args: []
/// `text` in `width` units of mono 20: whole, or cut at its far end with `…`.
pub fn fitted(u: ui.Ui, text: []const u8, width: f32) []const u8 {
- const chars: usize = @intFromFloat(@max(width / adv, 1));
+ // (A width measured without a room is infinite: whole.)
+ const chars: usize = @intFromFloat(std.math.clamp(width / adv, 1, 1 << 16));
if (text.len <= chars) return text;
return u.print("{s}\u{2026}", .{text[0 .. chars - 1]});
}
@@ -378,7 +379,9 @@ pub fn line(u: ui.Ui, y: f32, w: f32, number: u32, widen: f32, text: []const u8,
const on = state == .current or state == .marked;
const num = u.print("{d}", .{number});
u.text(if (on) .mono_bold else .mono, size, m.line_number_end + widen - @as(f32, @floatFromInt(num.len)) * adv, baseline(y), num, if (on) gold.on_solid else t.faint);
- const limit: usize = m.source_chars - @as(usize, @intFromFloat(widen / adv));
+ // Cut as much sooner as the row is narrower than its column (a pane's strip takes 48: four characters).
+ const cut: usize = @intFromFloat(@max(theme.layout.program.w - w, 0) / adv);
+ const limit: usize = m.source_chars - @as(usize, @intFromFloat(widen / adv)) - cut;
const end = @min(text.len, limit);
var i: usize = 0;
while (i < end) {
@@ -490,6 +493,10 @@ pub fn bytesAt(at: ui.Ui, y: f32, addr: u64, values: *const [16]u8, known: *cons
u.fill(.{ .x = bx0, .y = r.y - h.out, .w = bx1 - bx0, .h = r.h + 2 * h.out }, ui.mix(theme.color.raised, theme.color.struck, solid));
};
u.corner(s0, y + 2, m.corner, h.level * h.corner);
+ if (ui.strokes) {
+ if (h.level >= 1 and h.solid * h.in > 0) ui.collectMark(u, s0, y + row_h / 2, .struck, h.solid * h.in) else ui.collectMark(u, s0, y + row_h / 2, .held, h.level * h.corner);
+ ui.collectMark(u, x0, y + row_h / 2, .read, run.read);
+ }
if (run.read > 0) u.faded(run.read).frame(.{ .x = x0 - 3, .y = y - 1, .w = x1 - x0 + 6, .h = row_h + 2 }, theme.mark(.read).solid, 2);
// A little-endian word: the bytes above its highest non-zero one are its padding.
var top: usize = 0;
@@ -564,6 +571,17 @@ pub const Arcs = struct {
/// without it to those they have with it, as far as it has drawn or shows.
pub fn draw(a: *Arcs, u: ui.Ui, lanes: usize) void {
const k = theme.metric.arc;
+ // For a strip: each arc's rows, the middles of its pointer's and its target's.
+ if (ui.strokes) {
+ const c = &ui.collected;
+ for (a.items[0..a.n]) |arc| if (!arc.stub and c.n_arcs < c.arcs.len) {
+ const p = u.at.xf.apply(.{ 0, arc.from + row_h / 2 });
+ const q = u.at.xf.apply(.{ 0, arc.to + row_h / 2 });
+ c.arcs[c.n_arcs] = .{ .x = p[0], .from = p[1], .to = q[1], .ink = u.faded(arc.shows).at.faded(ui.rgb(arc.ink)) };
+ c.n_arcs += 1;
+ };
+ return;
+ }
var spans: [32]Span = undefined;
for (a.items[0..a.n], spans[0..a.n], 0..) |arc, *sp, i| {
const up = arc.to < arc.from;