diff --git a/src/animations/DurFile.zig b/src/animations/DurFile.zig index 42f66e9..9ec9eaf 100644 --- a/src/animations/DurFile.zig +++ b/src/animations/DurFile.zig @@ -318,9 +318,11 @@ fn calc_start_position(terminal_buffer: *TerminalBuffer, dur_movie: *DurFormat, const buf_width: u32 = @intCast(terminal_buffer.width); const buf_height: u32 = @intCast(terminal_buffer.height); - const movie_width: u32 = @intCast(dur_movie.columns.?); - const movie_height: u32 = @intCast(dur_movie.lines.?); + var movie_width: u32 = @intCast(dur_movie.columns.?); + var movie_height: u32 = @intCast(dur_movie.lines.?); + if (movie_width > buf_width) movie_width = buf_width; + if (movie_height > buf_height) movie_height = buf_height; const start_pos: IVec2 = switch (offset_alignment) { DurOffsetAlignment.center => .{ center(buf_width) - center(movie_width), center(buf_height) - center(movie_height) },