window: do not attempt to fill offscreen windows

This commit is contained in:
CJ van den Berg 2024-05-17 21:54:37 +02:00 committed by Tim Culverhouse
parent 4f5db2b224
commit 329ba0e43b

View file

@ -213,6 +213,10 @@ pub fn gwidth(self: Window, str: []const u8) usize {
/// fills the window with the provided cell /// fills the window with the provided cell
pub fn fill(self: Window, cell: Cell) void { 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) { if (self.x_off == 0 and self.width == self.screen.width) {
// we have a full width window, therefore contiguous memory. // we have a full width window, therefore contiguous memory.
const start = self.y_off * self.width; const start = self.y_off * self.width;