From 5a40dca5adb6e9e650f55f3ec6f254a13bf50493 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 13 Nov 2026 01:24:16 -0300 Subject: debugger: align source and add rich Vim-style navigation --- anim/src/rows.zig | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'anim/src/rows.zig') diff --git a/anim/src/rows.zig b/anim/src/rows.zig index bdf9454..4666ffd 100644 --- a/anim/src/rows.zig +++ b/anim/src/rows.zig @@ -113,7 +113,7 @@ pub const Hops = struct { /// then the chain ends early in `more`; nothing is taken from the middle. pub fn chain(u: ui.Ui, x: f32, y: f32, moment: Recording.Moment, value: u64, room: f32, marks: Marks) Hops { var links_buf: [6]zt.telescope.Link = undefined; - var text_buf: [48]u8 = undefined; + var text_buf: [256]u8 = undefined; const links = zt.telescope.chase(moment, value, &links_buf, &text_buf) catch return .{}; const base = baseline(y); const mid = y + row_h / 2; @@ -247,13 +247,20 @@ pub fn rip(u: ui.Ui, y: f32, w: f32, moment: Recording.Moment, pc: u64, eflags: 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); const fl = theme.metric.flags; - var x = w - m.side - @as(f32, flags.len) * fl.pitch + 10; + const x = w - m.side - @as(f32, flags.len) * fl.pitch + 10; // Where execution is changes with the advance: the old value goes as the new one comes, over it. const before = was orelse RipWas{ .moment = moment, .pc = pc, .eflags = eflags }; if (before.pc != pc and before.going < 1) { _ = chain(u.faded(1 - before.going), m.chain_x, y, before.moment, before.pc, x - 16, .{}); _ = chain(u.faded(before.going), m.chain_x, y, moment, pc, x - 16, .{}); } else _ = chain(u, m.chain_x, y, moment, pc, x - 16, .{}); + ripFlags(u, x, y, eflags, changed, held, read, read_shows, before); +} + +/// The flag chips on their own row, for narrower live register panes. +pub fn ripFlags(u: ui.Ui, start: f32, y: f32, eflags: u64, changed: u64, held: f32, read: u64, read_shows: f32, before: RipWas) void { + const fl = theme.metric.flags; + var x = start; for (flags) |flag| { const set = eflags >> flag.bit & 1 != 0; // A flag the step sets or clears crossfades as it lands (`flip`). @@ -429,7 +436,7 @@ pub fn line(u: ui.Ui, y: f32, w: f32, number: u32, widen: f32, text: []const u8, 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); // 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 limit: usize = m.source_chars -| @as(usize, @intFromFloat(widen / adv)) -| cut; const end = @min(text.len, limit); var i: usize = 0; while (i < end) { -- cgit v1.3