mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-18 17:56:09 +03:00
terminal: when growing rows, need to set rows before grow()
grow() will not prune pages that are needed for the active but that requires an accurate self.rows. We were setting this too late.
This commit is contained in:
@ -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;
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2091,7 +2095,7 @@ pub fn eraseRowBounded(
|
|||||||
// and update our pins.
|
// and update our pins.
|
||||||
if (page.data.size.rows - pn.y > limit) {
|
if (page.data.size.rows - pn.y > limit) {
|
||||||
page.data.clearCells(&rows[pn.y], 0, page.data.size.cols);
|
page.data.clearCells(&rows[pn.y], 0, page.data.size.cols);
|
||||||
fastmem.rotateOnce(Row, rows[pn.y..][0..limit + 1]);
|
fastmem.rotateOnce(Row, rows[pn.y..][0 .. limit + 1]);
|
||||||
|
|
||||||
// Update pins in the shifted region.
|
// Update pins in the shifted region.
|
||||||
var pin_it = self.tracked_pins.keyIterator();
|
var pin_it = self.tracked_pins.keyIterator();
|
||||||
@ -2135,7 +2139,7 @@ pub fn eraseRowBounded(
|
|||||||
const shifted_limit = limit - shifted;
|
const shifted_limit = limit - shifted;
|
||||||
if (page.data.size.rows > shifted_limit) {
|
if (page.data.size.rows > shifted_limit) {
|
||||||
page.data.clearCells(&rows[0], 0, page.data.size.cols);
|
page.data.clearCells(&rows[0], 0, page.data.size.cols);
|
||||||
fastmem.rotateOnce(Row, rows[0..shifted_limit + 1]);
|
fastmem.rotateOnce(Row, rows[0 .. shifted_limit + 1]);
|
||||||
|
|
||||||
// Update pins in the shifted region.
|
// Update pins in the shifted region.
|
||||||
var pin_it = self.tracked_pins.keyIterator();
|
var pin_it = self.tracked_pins.keyIterator();
|
||||||
|
Reference in New Issue
Block a user