diff options
Diffstat (limited to 'anim/src/Recording.zig')
| -rw-r--r-- | anim/src/Recording.zig | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/anim/src/Recording.zig b/anim/src/Recording.zig index 359305c..4bc9c1b 100644 --- a/anim/src/Recording.zig +++ b/anim/src/Recording.zig @@ -288,7 +288,9 @@ pub fn sourced(r: *const Recording, i: u64) bool { /// for every line of that third, so that the text moves only when the /// program has moved on. pub fn viewFirst(fit: u32, lines: u32, line: u32) u32 { - if (lines <= fit or fit < 3) return 1; + if (lines <= fit or fit == 0) return 1; + // One or two lines (a column's pane): the line itself, first. + if (fit < 3) return std.math.clamp(line, 1, lines - fit + 1); const third = fit / 3; const band = (@max(line, 1) - 1) / third; return std.math.clamp(@as(u32, @intCast(@max(@as(i64, band) - 1, 0))) * third + 1, 1, lines - fit + 1); |
