From 8a5dadd995377ca643aa53f6c7f71e0d6314d3aa Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 8 Aug 2022 10:38:24 -0700 Subject: [PATCH] rowIndex uses tag max so we have max in just one place --- src/terminal/Screen.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/terminal/Screen.zig b/src/terminal/Screen.zig index 33d029ede..3c129f71b 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -265,20 +265,20 @@ pub fn getCell(self: Screen, row: usize, col: usize) *Cell { /// Returns the index for the given row (0-indexed) into the underlying /// storage array. The row is 0-indexed from the top of the screen. -fn rowIndex(self: Screen, idx: RowIndex) usize { +fn rowIndex(self: *const Screen, idx: RowIndex) usize { const y = switch (idx) { .screen => |y| y: { - assert(y < self.bottom); + assert(y <= RowIndexTag.screen.max(self)); break :y y; }, .viewport => |y| y: { - assert(y < self.rows); + assert(y <= RowIndexTag.viewport.max(self)); break :y y + self.visible_offset; }, .active => |y| y: { - assert(y < self.rows); + assert(y <= RowIndexTag.active.max(self)); break :y self.bottomOffset() + y; }, };