mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-20 02:36:22 +03:00
terminal: resize cols without reflow handles higher caps
This commit is contained in:
@ -581,7 +581,7 @@ fn resizeCols(
|
||||
if (row.wrap) break :no_reflow;
|
||||
}
|
||||
|
||||
try self.resizeWithoutReflowGrowCols(cap, chunk);
|
||||
try self.resizeWithoutReflowGrowCols(cols, chunk);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1245,11 +1245,9 @@ fn resizeWithoutReflow(self: *PageList, opts: Resize) !void {
|
||||
// pages may not have the capacity for this. If they don't have
|
||||
// the capacity we need to allocate a new page and copy the data.
|
||||
.gt => {
|
||||
const cap = try std_capacity.adjust(.{ .cols = cols });
|
||||
|
||||
var it = self.pageIterator(.right_down, .{ .screen = .{} }, null);
|
||||
while (it.next()) |chunk| {
|
||||
try self.resizeWithoutReflowGrowCols(cap, chunk);
|
||||
try self.resizeWithoutReflowGrowCols(cols, chunk);
|
||||
}
|
||||
|
||||
self.cols = cols;
|
||||
@ -1260,11 +1258,12 @@ fn resizeWithoutReflow(self: *PageList, opts: Resize) !void {
|
||||
|
||||
fn resizeWithoutReflowGrowCols(
|
||||
self: *PageList,
|
||||
cap: Capacity,
|
||||
cols: size.CellCountInt,
|
||||
chunk: PageIterator.Chunk,
|
||||
) !void {
|
||||
assert(cap.cols > self.cols);
|
||||
assert(cols > self.cols);
|
||||
const page = &chunk.page.data;
|
||||
const cap = try page.capacity.adjust(.{ .cols = cols });
|
||||
|
||||
// Update our col count
|
||||
const old_cols = self.cols;
|
||||
|
@ -7708,6 +7708,26 @@ test "Terminal: resize with wraparound on" {
|
||||
try testing.expectEqualStrings("01\n23", str);
|
||||
}
|
||||
|
||||
test "Terminal: resize with high unique style per cell" {
|
||||
const alloc = testing.allocator;
|
||||
var t = try init(alloc, 30, 30);
|
||||
defer t.deinit(alloc);
|
||||
|
||||
for (0..t.rows) |y| {
|
||||
for (0..t.cols) |x| {
|
||||
t.setCursorPos(y, x);
|
||||
try t.setAttribute(.{ .direct_color_bg = .{
|
||||
.r = @intCast(x),
|
||||
.g = @intCast(y),
|
||||
.b = 0,
|
||||
} });
|
||||
try t.print('x');
|
||||
}
|
||||
}
|
||||
|
||||
try t.resize(alloc, 60, 30);
|
||||
}
|
||||
|
||||
test "Terminal: DECCOLM without DEC mode 40" {
|
||||
const alloc = testing.allocator;
|
||||
var t = try init(alloc, 5, 5);
|
||||
|
Reference in New Issue
Block a user