mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +03:00
terminal: deleteLines resets line wrap
This commit is contained in:
@ -1475,6 +1475,9 @@ pub fn deleteLines(self: *Terminal, count_req: usize) void {
|
|||||||
unreachable;
|
unreachable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Row never is wrapped
|
||||||
|
dst.wrap = false;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1484,6 +1487,9 @@ pub fn deleteLines(self: *Terminal, count_req: usize) void {
|
|||||||
dst.* = src.*;
|
dst.* = src.*;
|
||||||
src.* = dst_row;
|
src.* = dst_row;
|
||||||
|
|
||||||
|
// Row never is wrapped
|
||||||
|
dst.wrap = false;
|
||||||
|
|
||||||
// Ensure what we did didn't corrupt the page
|
// Ensure what we did didn't corrupt the page
|
||||||
p.page.data.assertIntegrity();
|
p.page.data.assertIntegrity();
|
||||||
continue;
|
continue;
|
||||||
@ -1500,6 +1506,9 @@ pub fn deleteLines(self: *Terminal, count_req: usize) void {
|
|||||||
self.scrolling_region.left,
|
self.scrolling_region.left,
|
||||||
(self.scrolling_region.right - self.scrolling_region.left) + 1,
|
(self.scrolling_region.right - self.scrolling_region.left) + 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Row never is wrapped
|
||||||
|
dst.wrap = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The operations above can prune our cursor style so we need to
|
// The operations above can prune our cursor style so we need to
|
||||||
@ -5950,7 +5959,7 @@ test "Terminal: deleteLines with scroll region, cursor outside of region" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test "Terminal: deleteLines resets wrap" {
|
test "Terminal: deleteLines resets pending wrap" {
|
||||||
const alloc = testing.allocator;
|
const alloc = testing.allocator;
|
||||||
var t = try init(alloc, .{ .rows = 5, .cols = 5 });
|
var t = try init(alloc, .{ .rows = 5, .cols = 5 });
|
||||||
defer t.deinit(alloc);
|
defer t.deinit(alloc);
|
||||||
@ -5968,6 +5977,34 @@ test "Terminal: deleteLines resets wrap" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "Terminal: deleteLines resets wrap" {
|
||||||
|
const alloc = testing.allocator;
|
||||||
|
var t = try init(alloc, .{ .rows = 3, .cols = 3 });
|
||||||
|
defer t.deinit(alloc);
|
||||||
|
|
||||||
|
try t.print('1');
|
||||||
|
t.carriageReturn();
|
||||||
|
try t.linefeed();
|
||||||
|
for ("ABCDEF") |c| try t.print(c);
|
||||||
|
|
||||||
|
t.setTopAndBottomMargin(1, 2);
|
||||||
|
t.setCursorPos(1, 1);
|
||||||
|
t.deleteLines(1);
|
||||||
|
try t.print('X');
|
||||||
|
|
||||||
|
{
|
||||||
|
const str = try t.plainString(testing.allocator);
|
||||||
|
defer testing.allocator.free(str);
|
||||||
|
try testing.expectEqualStrings("XBC\n\nDEF", str);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (0..t.rows) |y| {
|
||||||
|
const list_cell = t.screen.pages.getCell(.{ .active = .{ .x = 0, .y = y } }).?;
|
||||||
|
const row = list_cell.row;
|
||||||
|
try testing.expect(!row.wrap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
test "Terminal: deleteLines left/right scroll region" {
|
test "Terminal: deleteLines left/right scroll region" {
|
||||||
const alloc = testing.allocator;
|
const alloc = testing.allocator;
|
||||||
var t = try init(alloc, .{ .cols = 10, .rows = 10 });
|
var t = try init(alloc, .{ .cols = 10, .rows = 10 });
|
||||||
|
Reference in New Issue
Block a user