mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-24 20:56:08 +03:00
fix(terminal/PageList): update viewport in row count resize
Before, if the row count increase past the active area then we added new rows to make sure that we had enough for the active area, but we didn't make sure that the viewport pin wasn't below the active area pin, which meant that later on if someone tried to get the bottom right pin for the viewport it would overshoot and we'd use null. This resulted in either a memory corruption bug in ReleaseFast if you scaled down the font while scrolled up slightly, or in Debug mode it was just a crash.
This commit is contained in:
@ -1401,6 +1401,15 @@ fn resizeWithoutReflow(self: *PageList, opts: Resize) !void {
|
||||
assert(count < rows);
|
||||
for (count..rows) |_| _ = try self.grow();
|
||||
}
|
||||
|
||||
// Make sure that the viewport pin isn't below the active
|
||||
// area, since that will lead to all sorts of problems.
|
||||
switch (self.viewport) {
|
||||
.pin => if (self.pinIsActive(self.viewport_pin.*)) {
|
||||
self.viewport = .{ .active = {} };
|
||||
},
|
||||
.active, .top => {},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user