From a2cf11606379a13880c800b27886ba2e220b138b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 8 Aug 2022 14:20:52 -0700 Subject: [PATCH] fix a crash when reflowing to smaller cols but still buggy --- src/terminal/Screen.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/terminal/Screen.zig b/src/terminal/Screen.zig index 13761ecaf..9ff64b995 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -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 (y >= self.rows) { self.scroll(.{ .delta = 1 }); - y -= 1; + y = self.rows - 1; 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 + // log.warn("y={} x={} rows={}", .{ y, x, self.rows }); var new_cell = self.getCell(y, x); new_cell.* = cell; new_cell.attrs.wrap = 0;