From 8d40fba9ced4587351f582c2413c0ac32e1a4f54 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 23 Jun 2023 14:06:40 -0700 Subject: [PATCH] terminal: correct assertion for scrollUp --- src/terminal/Screen.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/terminal/Screen.zig b/src/terminal/Screen.zig index 6bacf9ded..3d3ea2510 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -1019,7 +1019,9 @@ pub fn scrollRegionUp(self: *Screen, top: RowIndex, bottom: RowIndex, count: usi // If top is outside of the range of bot, we do nothing. if (top_y >= bot_y) return; - assert(count <= (bot_y - top_y)); + // We can only scroll up to the number of rows in the region. The "+ 1" + // is because our y values are 0-based and count is 1-based. + assert(count <= (bot_y - top_y + 1)); // Get the storage pointer for the full scroll region. We're going to // be modifying the whole thing so we get it right away.