mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
screen: resize more rows preserves soft wrapped flag
This commit is contained in:
@ -402,6 +402,9 @@ pub const Row = struct {
|
||||
// If we have graphemes, clear first to unset them.
|
||||
if (self.storage[0].header.flags.grapheme) self.clear(.{});
|
||||
|
||||
// Copy the flags
|
||||
self.storage[0].header.flags = src.storage[0].header.flags;
|
||||
|
||||
// Always mark the row as dirty for this.
|
||||
self.storage[0].header.flags.dirty = true;
|
||||
|
||||
@ -3735,6 +3738,45 @@ test "Screen: resize (no reflow) grapheme copy" {
|
||||
}
|
||||
}
|
||||
|
||||
test "Screen: resize (no reflow) more rows with soft wrapping" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
||||
var s = try init(alloc, 3, 2, 3);
|
||||
defer s.deinit();
|
||||
const str = "1A2B\n3C4E\n5F6G";
|
||||
try s.testWriteString(str);
|
||||
|
||||
// Every second row should be wrapped
|
||||
{
|
||||
var y: usize = 0;
|
||||
while (y < 6) : (y += 1) {
|
||||
const row = s.getRow(.{ .screen = y });
|
||||
const wrapped = (y % 2 == 0);
|
||||
try testing.expectEqual(wrapped, row.header().flags.wrap);
|
||||
}
|
||||
}
|
||||
|
||||
// Resize
|
||||
try s.resizeWithoutReflow(10, 2);
|
||||
{
|
||||
var contents = try s.testString(alloc, .viewport);
|
||||
defer alloc.free(contents);
|
||||
const expected = "1A\n2B\n3C\n4E\n5F\n6G";
|
||||
try testing.expectEqualStrings(expected, contents);
|
||||
}
|
||||
|
||||
// Every second row should be wrapped
|
||||
{
|
||||
var y: usize = 0;
|
||||
while (y < 6) : (y += 1) {
|
||||
const row = s.getRow(.{ .screen = y });
|
||||
const wrapped = (y % 2 == 0);
|
||||
try testing.expectEqual(wrapped, row.header().flags.wrap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test "Screen: resize more rows no scrollback" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
Reference in New Issue
Block a user