mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
terminal: ECH minimum count is 1
This commit is contained in:
@ -1346,10 +1346,12 @@ pub fn deleteChars(self: *Terminal, count: usize) !void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn eraseChars(self: *Terminal, count: usize) void {
|
pub fn eraseChars(self: *Terminal, count_req: usize) void {
|
||||||
const tracy = trace(@src());
|
const tracy = trace(@src());
|
||||||
defer tracy.end();
|
defer tracy.end();
|
||||||
|
|
||||||
|
const count = @max(count_req, 1);
|
||||||
|
|
||||||
// This resets the pending wrap state
|
// This resets the pending wrap state
|
||||||
self.screen.cursor.pending_wrap = false;
|
self.screen.cursor.pending_wrap = false;
|
||||||
|
|
||||||
@ -4787,6 +4789,23 @@ test "Terminal: eraseChars simple operation" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "Terminal: eraseChars minimum one" {
|
||||||
|
const alloc = testing.allocator;
|
||||||
|
var t = try init(alloc, 5, 5);
|
||||||
|
defer t.deinit(alloc);
|
||||||
|
|
||||||
|
for ("ABC") |c| try t.print(c);
|
||||||
|
t.setCursorPos(1, 1);
|
||||||
|
t.eraseChars(0);
|
||||||
|
try t.print('X');
|
||||||
|
|
||||||
|
{
|
||||||
|
var str = try t.plainString(testing.allocator);
|
||||||
|
defer testing.allocator.free(str);
|
||||||
|
try testing.expectEqualStrings("XBC", str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
test "Terminal: eraseChars beyond screen edge" {
|
test "Terminal: eraseChars beyond screen edge" {
|
||||||
const alloc = testing.allocator;
|
const alloc = testing.allocator;
|
||||||
var t = try init(alloc, 5, 5);
|
var t = try init(alloc, 5, 5);
|
||||||
|
Reference in New Issue
Block a user