From f06c11fc848ce2dd37d5a2d4d28ba995bd437894 Mon Sep 17 00:00:00 2001 From: Matteo Romano <52749992+Nemoos-0@users.noreply.github.com> Date: Fri, 13 Dec 2024 22:16:54 +0100 Subject: [PATCH] fix child scroll --- src/Window.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Window.zig b/src/Window.zig index eb825e5..712656b 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -438,10 +438,10 @@ pub fn scroll(self: Window, n: u16) void { var row: u16 = @max(self.y_off, 0); const first_col: u16 = @max(self.x_off, 0); while (row < self.height - n) : (row += 1) { - const dst_start = (row * self.width) + first_col; + const dst_start = (row * self.screen.width) + first_col; const dst_end = dst_start + self.width; - const src_start = ((row + n) * self.width) + first_col; + const src_start = ((row + n) * self.screen.width) + first_col; const src_end = src_start + self.width; @memcpy(self.screen.buf[dst_start..dst_end], self.screen.buf[src_start..src_end]); }