From 3093eb55ac4a7054f51f06ea2786b5f9c9ec73f6 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 11 Nov 2026 14:43:13 -0300 Subject: canim: a minimap in each pane; source wherever it can be had, libc's included From the user. Each pane with more than it shows carries a strip of its whole column at its right edge, the pane's window outlined and what happens off it marked there; the corner minimap is gone and the dive folds each column of the map into its pane's strip. The source panel follows the pc into any file the build has: glibc's own, from the distro's debuginfod by an optional step that caches them by build id (zig build sources; nothing else touches the network), and musl's, from Zig's lib directory. The syscalls scene shows open64.c on the way down, and a new scene follows the same call through a Zig-built musl. A graph's counts and inks are as of the moment shown. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa --- anim/src/rows.zig | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'anim/src/rows.zig') 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; -- cgit v1.3