mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
terminal: insertLines clears row wrap state
This commit is contained in:
@ -1337,6 +1337,9 @@ pub fn insertLines(self: *Terminal, count: usize) void {
|
||||
unreachable;
|
||||
};
|
||||
|
||||
// Row never is wrapped
|
||||
dst.wrap = false;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1346,6 +1349,10 @@ pub fn insertLines(self: *Terminal, count: usize) void {
|
||||
dst.* = src.*;
|
||||
src.* = dst_row;
|
||||
|
||||
// Row never is wrapped
|
||||
dst.wrap = false;
|
||||
src.wrap = false;
|
||||
|
||||
// Ensure what we did didn't corrupt the page
|
||||
p.page.data.assertIntegrity();
|
||||
continue;
|
||||
@ -1362,6 +1369,9 @@ pub fn insertLines(self: *Terminal, count: usize) void {
|
||||
self.scrolling_region.left,
|
||||
(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
|
||||
@ -4237,7 +4247,7 @@ test "Terminal: insertLines more than remaining" {
|
||||
}
|
||||
}
|
||||
|
||||
test "Terminal: insertLines resets wrap" {
|
||||
test "Terminal: insertLines resets pending wrap" {
|
||||
const alloc = testing.allocator;
|
||||
var t = try init(alloc, .{ .rows = 5, .cols = 5 });
|
||||
defer t.deinit(alloc);
|
||||
@ -4255,6 +4265,32 @@ test "Terminal: insertLines resets wrap" {
|
||||
}
|
||||
}
|
||||
|
||||
test "Terminal: insertLines 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.setCursorPos(1, 1);
|
||||
t.insertLines(1);
|
||||
try t.print('X');
|
||||
|
||||
{
|
||||
const str = try t.plainString(testing.allocator);
|
||||
defer testing.allocator.free(str);
|
||||
try testing.expectEqualStrings("X\n1\nABC", str);
|
||||
}
|
||||
|
||||
{
|
||||
const list_cell = t.screen.pages.getCell(.{ .active = .{ .x = 0, .y = 2 } }).?;
|
||||
const row = list_cell.row;
|
||||
try testing.expect(!row.wrap);
|
||||
}
|
||||
}
|
||||
|
||||
test "Terminal: insertLines multi-codepoint graphemes" {
|
||||
const alloc = testing.allocator;
|
||||
var t = try init(alloc, .{ .rows = 5, .cols = 5 });
|
||||
|
Reference in New Issue
Block a user