fix(renderer): allocate enough room for fg cells

Previously encountered OOB when screen filled with cells with glyphs,
underlines, and strikethroughs. Also clarified comment slightly.
This commit is contained in:
Qwerasd
2024-03-03 20:26:51 -05:00
parent b5b2eac245
commit e8460fa2c2
2 changed files with 4 additions and 4 deletions

View File

@ -1552,9 +1552,9 @@ fn rebuildCells(
try self.cells.ensureTotalCapacity( try self.cells.ensureTotalCapacity(
self.alloc, self.alloc,
// * 3 for background modes and cursor and underlines // * 3 for glyph + underline + strikethrough for each cell
// + 1 for cursor // + 1 for cursor
(screen.rows * screen.cols * 2) + 1, (screen.rows * screen.cols * 3) + 1,
); );
// Create an arena for all our temporary allocations while rebuilding // Create an arena for all our temporary allocations while rebuilding

View File

@ -973,9 +973,9 @@ pub fn rebuildCells(
try self.cells.ensureTotalCapacity( try self.cells.ensureTotalCapacity(
self.alloc, self.alloc,
// * 3 for background modes and cursor and underlines // * 3 for glyph + underline + strikethrough for each cell
// + 1 for cursor // + 1 for cursor
(screen.rows * screen.cols * 2) + 1, (screen.rows * screen.cols * 3) + 1,
); );
// Create an arena for all our temporary allocations while rebuilding // Create an arena for all our temporary allocations while rebuilding