terminal: correct assertion for scrollUp

This commit is contained in:
Mitchell Hashimoto
2023-06-23 14:06:40 -07:00
parent 30fdbaebf4
commit 8d40fba9ce

View File

@ -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 is outside of the range of bot, we do nothing.
if (top_y >= bot_y) return; 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 // Get the storage pointer for the full scroll region. We're going to
// be modifying the whole thing so we get it right away. // be modifying the whole thing so we get it right away.