terminal: ECH resets line wrap state in any scenario

This commit is contained in:
Mitchell Hashimoto
2024-01-19 14:31:33 -08:00
parent bab932431f
commit e9fe14c750
2 changed files with 33 additions and 2 deletions

View File

@@ -1497,6 +1497,9 @@ pub fn eraseChars(self: *Terminal, count_req: usize) void {
break :end end;
};
// This resets the soft-wrap of this line
row.setWrapped(false);
const pen: Screen.Cell = .{
.bg = self.screen.cursor.pen.bg,
};
@@ -4838,7 +4841,7 @@ test "Terminal: deleteChars split wide character tail" {
}
}
test "Terminal: eraseChars resets wrap" {
test "Terminal: eraseChars resets pending wrap" {
const alloc = testing.allocator;
var t = try init(alloc, 5, 5);
defer t.deinit(alloc);
@@ -4856,6 +4859,33 @@ test "Terminal: eraseChars resets wrap" {
}
}
test "Terminal: eraseChars resets wrap" {
const alloc = testing.allocator;
var t = try init(alloc, 5, 5);
defer t.deinit(alloc);
for ("ABCDE123") |c| try t.print(c);
{
const row = t.screen.getRow(.{ .active = 0 });
try testing.expect(row.isWrapped());
}
t.setCursorPos(1, 1);
t.eraseChars(1);
{
const row = t.screen.getRow(.{ .active = 0 });
try testing.expect(!row.isWrapped());
}
try t.print('X');
{
const str = try t.plainString(testing.allocator);
defer testing.allocator.free(str);
try testing.expectEqualStrings("XBCDE\n123", str);
}
}
test "Terminal: eraseChars simple operation" {
const alloc = testing.allocator;
var t = try init(alloc, 5, 5);