From 487f08b1ddf7a7e48f4395e103b6cf1b36b423b0 Mon Sep 17 00:00:00 2001 From: Qwerasd Date: Sun, 27 Oct 2024 12:45:12 -0400 Subject: [PATCH] fix(PageList, Page): fix off-by-1 in map capacity checks We're already using `>=`, we don't need to also use `- 1` --- src/terminal/PageList.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/terminal/PageList.zig b/src/terminal/PageList.zig index 8d9641bfa..d86ebc765 100644 --- a/src/terminal/PageList.zig +++ b/src/terminal/PageList.zig @@ -896,7 +896,7 @@ const ReflowCursor = struct { // If our page can't support an additional cell with // graphemes then we create a new page for this row. - if (self.page.graphemeCount() >= self.page.graphemeCapacity() - 1) { + if (self.page.graphemeCount() >= self.page.graphemeCapacity()) { try self.moveLastRowToNewPage(list, cap); } else { // Attempt to allocate the space that would be required for @@ -924,7 +924,7 @@ const ReflowCursor = struct { // If our page can't support an additional cell with // a hyperlink ID then we create a new page for this row. - if (self.page.hyperlinkCount() >= self.page.hyperlinkCapacity() - 1) { + if (self.page.hyperlinkCount() >= self.page.hyperlinkCapacity()) { try self.moveLastRowToNewPage(list, cap); }