summaryrefslogtreecommitdiff
path: root/anim/src/cursor.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-11 14:43:13 -0300
committerGabriel Schneider <[email protected]>2026-11-11 16:17:33 -0300
commit3093eb55ac4a7054f51f06ea2786b5f9c9ec73f6 (patch)
treef1bc91879a447f178dfaba39d0df107d01e557bd /anim/src/cursor.zig
parenta72831d5c322078260314c305ddd940e4967947d (diff)
downloadcomputeranim-3093eb55ac4a7054f51f06ea2786b5f9c9ec73f6.tar.gz
computeranim-3093eb55ac4a7054f51f06ea2786b5f9c9ec73f6.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/src/cursor.zig')
-rw-r--r--anim/src/cursor.zig21
1 files changed, 16 insertions, 5 deletions
diff --git a/anim/src/cursor.zig b/anim/src/cursor.zig
index f0f90ff..9de02c1 100644
--- a/anim/src/cursor.zig
+++ b/anim/src/cursor.zig
@@ -394,10 +394,19 @@ pub const Cursor = struct {
/// or at the end of a continue (`wave`).
fn travel(c: Cursor, from: u64, to: u64, wave: bool) f32 {
const rec = c.rec;
- // The source's window moves with it: by whole lines, and never a cut.
- if (rec.viewFirst(c.levels.source_rows, rec.own[from]) != rec.viewFirst(c.levels.source_rows, rec.own[to])) return time.move;
+ const a = rec.shown[from];
+ const b = rec.shown[to];
+ // Another file: the source fades through (12 f out, 12 f in).
+ if (a.src != b.src) return time.move;
+ // The source's window moves with it: by whole lines, and never a cut;
+ // farther than its own height, its strip shows where it goes first
+ // (the window gliding there, 24 f), then the pane fades through.
+ const fit = c.levels.source_rows;
+ const windows = [2]u32{ rec.shownFirst(fit, a), rec.shownFirst(fit, b) };
+ if (@max(windows[0], windows[1]) - @min(windows[0], windows[1]) > fit) return 2 * time.move;
+ if (windows[0] != windows[1]) return time.move;
if (wave or jumps(rec, from, to)) return 2 * time.current_jump;
- const rows: f32 = @floatFromInt(@max(rec.own[from], rec.own[to]) - @min(rec.own[from], rec.own[to]));
+ const rows: f32 = @floatFromInt(@max(a.line, b.line) - @min(a.line, b.line));
return @min(time.step + time.step_per_row * @max(rows - 1, 0), time.step_max);
}
@@ -540,8 +549,10 @@ fn settled(s: *const anim.Frame, v: anim.Value) f32 {
/// (fades out there and in here) and does not slide: a call is not a
/// journey across the lines between.
pub fn jumps(rec: *const Recording, from: u64, to: u64) bool {
- const rows = @max(rec.own[from], rec.own[to]) - @min(rec.own[from], rec.own[to]);
- return rec.depths[from] != rec.depths[to] or rows > time.current_jump_rows;
+ const a = rec.shown[from];
+ const b = rec.shown[to];
+ const rows = @max(a.line, b.line) - @min(a.line, b.line);
+ return a.src != b.src or rec.depths[from] != rec.depths[to] or rows > time.current_jump_rows;
}
/// The cursor at one instant.