fix a crash when reflowing to smaller cols but still buggy

This commit is contained in:
Mitchell Hashimoto
2022-08-08 14:20:52 -07:00
parent f3d3d255fb
commit a2cf116063

View File

@ -705,7 +705,7 @@ pub fn resize(self: *Screen, alloc: Allocator, rows: usize, cols: usize) !void {
// If our y is more than our rows, we need to scroll // If our y is more than our rows, we need to scroll
if (y >= self.rows) { if (y >= self.rows) {
self.scroll(.{ .delta = 1 }); self.scroll(.{ .delta = 1 });
y -= 1; y = self.rows - 1;
x = 0; x = 0;
} }
@ -718,6 +718,7 @@ pub fn resize(self: *Screen, alloc: Allocator, rows: usize, cols: usize) !void {
} }
// Copy the old cell, unset the old wrap state // Copy the old cell, unset the old wrap state
// log.warn("y={} x={} rows={}", .{ y, x, self.rows });
var new_cell = self.getCell(y, x); var new_cell = self.getCell(y, x);
new_cell.* = cell; new_cell.* = cell;
new_cell.attrs.wrap = 0; new_cell.attrs.wrap = 0;