mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-23 20:26:09 +03:00
Merge pull request #529 from rockorager/alacritty/deccolm_reset
terminal: make deleteChars insert blank cells
This commit is contained in:
@ -1282,7 +1282,7 @@ pub fn deleteChars(self: *Terminal, count: usize) !void {
|
|||||||
for (self.screen.cursor.x..self.cols) |x| {
|
for (self.screen.cursor.x..self.cols) |x| {
|
||||||
const copy_x = x + count;
|
const copy_x = x + count;
|
||||||
if (copy_x >= self.cols) {
|
if (copy_x >= self.cols) {
|
||||||
line.getCellPtr(x).* = self.screen.cursor.pen;
|
line.getCellPtr(x).* = .{};
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2810,11 +2810,17 @@ test "Terminal: deleteChars" {
|
|||||||
for ("ABCDE") |c| try t.print(c);
|
for ("ABCDE") |c| try t.print(c);
|
||||||
t.setCursorPos(1, 2);
|
t.setCursorPos(1, 2);
|
||||||
|
|
||||||
|
// the cells that shifted in should not have this attribute set
|
||||||
|
t.screen.cursor.pen = .{ .attrs = .{ .bold = true } };
|
||||||
|
|
||||||
try t.deleteChars(2);
|
try t.deleteChars(2);
|
||||||
{
|
{
|
||||||
var str = try t.plainString(testing.allocator);
|
var str = try t.plainString(testing.allocator);
|
||||||
defer testing.allocator.free(str);
|
defer testing.allocator.free(str);
|
||||||
try testing.expectEqualStrings("ADE", str);
|
try testing.expectEqualStrings("ADE", str);
|
||||||
|
|
||||||
|
const cell = t.screen.getCell(.active, 0, 4);
|
||||||
|
try testing.expect(!cell.attrs.bold);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user