reflow: respect wraparound mode when reflowing text

When calling resize, Ghostty should be respecting the wraparound state.
This behavior matches xterm. Note that this same bug was also found in
kitty.

Fixes: #1343
This commit is contained in:
Tim Culverhouse
2024-01-21 06:41:43 -06:00
parent 83bf6e038e
commit 28732b950c

View File

@ -330,11 +330,19 @@ pub fn resize(self: *Terminal, alloc: Allocator, cols: usize, rows: usize) !void
// If we're making the screen smaller, dealloc the unused items.
if (self.active_screen == .primary) {
self.clearPromptForResize();
try self.screen.resize(rows, cols);
if (self.modes.get(.wraparound)) {
try self.screen.resize(rows, cols);
} else {
try self.screen.resizeWithoutReflow(rows, cols);
}
try self.secondary_screen.resizeWithoutReflow(rows, cols);
} else {
try self.screen.resizeWithoutReflow(rows, cols);
try self.secondary_screen.resize(rows, cols);
if (self.modes.get(.wraparound)) {
try self.secondary_screen.resize(rows, cols);
} else {
try self.secondary_screen.resizeWithoutReflow(rows, cols);
}
}
// Set our size