From b76995b5af19ec977db5dea36e84f62a2430be00 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 17 Mar 2024 21:13:07 -0700 Subject: [PATCH] terminal: resizing greater cols without reflow should preserve cols --- src/terminal/PageList.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/terminal/PageList.zig b/src/terminal/PageList.zig index 90754520d..4905dee2c 100644 --- a/src/terminal/PageList.zig +++ b/src/terminal/PageList.zig @@ -1247,8 +1247,15 @@ fn resizeWithoutReflow(self: *PageList, opts: Resize) !void { // pages may not have the capacity for this. If they don't have // the capacity we need to allocate a new page and copy the data. .gt => { + // See the comment in the while loop when setting self.cols + const old_cols = self.cols; + var it = self.pageIterator(.right_down, .{ .screen = .{} }, null); while (it.next()) |chunk| { + // We need to restore our old cols after we resize because + // we have an assertion on this and we want to be able to + // call this method multiple times. + self.cols = old_cols; try self.resizeWithoutReflowGrowCols(cols, chunk); }