From 329ba0e43b3db0c9e4722105998f90dca11312a9 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Fri, 17 May 2024 21:54:37 +0200 Subject: [PATCH] window: do not attempt to fill offscreen windows --- src/Window.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Window.zig b/src/Window.zig index 54b3120..f39b6e6 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -213,6 +213,10 @@ pub fn gwidth(self: Window, str: []const u8) usize { /// fills the window with the provided cell pub fn fill(self: Window, cell: Cell) void { + if (self.screen.width < self.x_off) + return; + if (self.screen.height < self.y_off) + return; if (self.x_off == 0 and self.width == self.screen.width) { // we have a full width window, therefore contiguous memory. const start = self.y_off * self.width;