From 9493561159ab931985a071f155568de71de505ef Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 8 Aug 2022 14:03:14 -0700 Subject: [PATCH] assertions to save our bacon --- src/terminal/Screen.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/terminal/Screen.zig b/src/terminal/Screen.zig index ac027cdef..14f384ac2 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -444,6 +444,13 @@ pub fn copyRow(self: *Screen, dst: usize, src: usize) void { /// This will trim data if the size is getting smaller. This will reflow the /// soft wrapped text. pub fn resize(self: *Screen, alloc: Allocator, rows: usize, cols: usize) !void { + defer { + assert(self.cursor.x < self.cols); + assert(self.cursor.y < self.rows); + assert(self.rows == rows); + assert(self.cols == cols); + } + // If the rows increased, we alloc space for the new rows (w/ existing cols) // and move the viewport such that the bottom is in view. if (rows > self.rows) {