terminal: PageList adjustCap should start from original cap

This commit is contained in:
Mitchell Hashimoto
2024-03-11 19:58:36 -07:00
parent ab1a302daa
commit a2e97a86d0

View File

@ -1561,9 +1561,9 @@ pub fn adjustCapacity(
page: *List.Node, page: *List.Node,
adjustment: AdjustCapacity, adjustment: AdjustCapacity,
) !*List.Node { ) !*List.Node {
// We always use our base capacity which is our standard // We always start with the base capacity of the existing page. This
// adjusted for our column size. // ensures we never shrink from what we need.
var cap = try std_capacity.adjust(.{ .cols = self.cols }); var cap = page.data.capacity;
// From there, we increase our capacity as required // From there, we increase our capacity as required
if (adjustment.styles) |v| { if (adjustment.styles) |v| {
@ -1571,6 +1571,8 @@ pub fn adjustCapacity(
cap.styles = @max(cap.styles, aligned); cap.styles = @max(cap.styles, aligned);
} }
log.info("adjusting page capacity={}", .{cap});
// Create our new page and clone the old page into it. // Create our new page and clone the old page into it.
const new_page = try self.createPage(cap); const new_page = try self.createPage(cap);
errdefer self.destroyPage(new_page); errdefer self.destroyPage(new_page);