From a2e97a86d0155bffa33728290d26de4c8030b8d1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 11 Mar 2024 19:58:36 -0700 Subject: [PATCH] terminal: PageList adjustCap should start from original cap --- src/terminal/PageList.zig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/terminal/PageList.zig b/src/terminal/PageList.zig index ebf1c7bec..e45f1d328 100644 --- a/src/terminal/PageList.zig +++ b/src/terminal/PageList.zig @@ -1561,9 +1561,9 @@ pub fn adjustCapacity( page: *List.Node, adjustment: AdjustCapacity, ) !*List.Node { - // We always use our base capacity which is our standard - // adjusted for our column size. - var cap = try std_capacity.adjust(.{ .cols = self.cols }); + // We always start with the base capacity of the existing page. This + // ensures we never shrink from what we need. + var cap = page.data.capacity; // From there, we increase our capacity as required if (adjustment.styles) |v| { @@ -1571,6 +1571,8 @@ pub fn adjustCapacity( cap.styles = @max(cap.styles, aligned); } + log.info("adjusting page capacity={}", .{cap}); + // Create our new page and clone the old page into it. const new_page = try self.createPage(cap); errdefer self.destroyPage(new_page);