diff options
Diffstat (limited to 'anim/src/rows.zig')
| -rw-r--r-- | anim/src/rows.zig | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/anim/src/rows.zig b/anim/src/rows.zig index 08f1fb2..bdf9454 100644 --- a/anim/src/rows.zig +++ b/anim/src/rows.zig @@ -326,9 +326,20 @@ pub fn slot(u: ui.Ui, y: f32, w: f32, moment: Recording.Moment, addr: u64, from_ return chain(u, at, y, moment, held, room, lead); } +/// The stack panel's offsets written with `0x` while it draws its rows +/// (`Levels.introduction`), where hex and decimal differ (10 and over), as +/// an instruction's operands and a value are (`-8`, `-0x18`). +pub var prefixed = false; + +/// `0x` in front of `n` (`prefixed`), or nothing. +pub fn hexMark(n: u64) []const u8 { + return if (prefixed and n >= 10) "0x" else ""; +} + /// A slot's offset from rsp, `from_rsp` bytes: hex, faint, ranged right to 172. fn offset(u: ui.Ui, y: f32, from_rsp: i64) void { - const text = if (from_rsp < 0) u.print("-{x}", .{@as(u64, @intCast(-from_rsp))}) else u.print("+{x}", .{@as(u64, @intCast(from_rsp))}); + const p = hexMark(@abs(from_rsp)); + const text = if (from_rsp < 0) u.print("-{s}{x}", .{ p, @as(u64, @intCast(-from_rsp)) }) else u.print("+{s}{x}", .{ p, @as(u64, @intCast(from_rsp)) }); u.text(.mono, size, theme.metric.slot.offset - u.width(.mono, size, text), baseline(y), text, t.faint); } |
