From e8460fa2c2d84140b47905dc0ad3fc3255b94c20 Mon Sep 17 00:00:00 2001 From: Qwerasd Date: Sun, 3 Mar 2024 20:26:51 -0500 Subject: [PATCH] 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. --- src/renderer/Metal.zig | 4 ++-- src/renderer/OpenGL.zig | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/renderer/Metal.zig b/src/renderer/Metal.zig index 0866e9a50..5f9542c72 100644 --- a/src/renderer/Metal.zig +++ b/src/renderer/Metal.zig @@ -1552,9 +1552,9 @@ fn rebuildCells( try self.cells.ensureTotalCapacity( self.alloc, - // * 3 for background modes and cursor and underlines + // * 3 for glyph + underline + strikethrough for each cell // + 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 diff --git a/src/renderer/OpenGL.zig b/src/renderer/OpenGL.zig index 608f4fdcb..77d42dc8f 100644 --- a/src/renderer/OpenGL.zig +++ b/src/renderer/OpenGL.zig @@ -973,9 +973,9 @@ pub fn rebuildCells( try self.cells.ensureTotalCapacity( self.alloc, - // * 3 for background modes and cursor and underlines + // * 3 for glyph + underline + strikethrough for each cell // + 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