Merge pull request #1617 from mitchellh/grow-rows

terminal: when growing rows, need to set rows before grow()
This commit is contained in:
Mitchell Hashimoto
2024-03-27 10:42:12 -07:00
committed by GitHub

View File

@ -1347,11 +1347,17 @@ fn resizeWithoutReflow(self: *PageList, opts: Resize) !void {
// Cursor is not at the bottom, so we just grow our // Cursor is not at the bottom, so we just grow our
// rows and we're done. Cursor does NOT change for this // rows and we're done. Cursor does NOT change for this
// since we're not pulling down scrollback. // since we're not pulling down scrollback.
for (0..rows - self.rows) |_| _ = try self.grow(); const delta = rows - self.rows;
self.rows = rows; self.rows = rows;
for (0..delta) |_| _ = try self.grow();
break :gt; break :gt;
} }
// This must be set BEFORE any calls to grow() so that
// grow() doesn't prune pages that we need for the active
// area.
self.rows = rows;
// Cursor is at the bottom or we don't care about cursors. // Cursor is at the bottom or we don't care about cursors.
// In this case, if we have enough rows in our pages, we // In this case, if we have enough rows in our pages, we
// just update our rows and we're done. This effectively // just update our rows and we're done. This effectively
@ -1368,8 +1374,6 @@ fn resizeWithoutReflow(self: *PageList, opts: Resize) !void {
assert(count < rows); assert(count < rows);
for (count..rows) |_| _ = try self.grow(); for (count..rows) |_| _ = try self.grow();
} }
self.rows = rows;
}, },
} }