mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
make erase a bit more efficient
This commit is contained in:
@ -74,6 +74,11 @@ pub fn rowIterator(self: *const Screen) RowIterator {
|
|||||||
return .{ .screen = self, .index = 0 };
|
return .{ .screen = self, .index = 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the visible portion of the screen.
|
||||||
|
pub fn getVisible(self: Screen) []Cell {
|
||||||
|
return self.storage;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get a single row by index (0-indexed).
|
/// Get a single row by index (0-indexed).
|
||||||
pub fn getRow(self: Screen, idx: usize) Row {
|
pub fn getRow(self: Screen, idx: usize) Row {
|
||||||
// Get the index of the first byte of the the row at index.
|
// Get the index of the first byte of the the row at index.
|
||||||
|
@ -223,15 +223,8 @@ pub fn eraseDisplay(
|
|||||||
) !void {
|
) !void {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
.complete => {
|
.complete => {
|
||||||
var y: usize = 0;
|
const all = self.screen.getVisible();
|
||||||
while (y < self.rows) : (y += 1) {
|
std.mem.set(Screen.Cell, all, self.cursor.pen);
|
||||||
var x: usize = 0;
|
|
||||||
while (x < self.cols) : (x += 1) {
|
|
||||||
const cell = try self.getOrPutCell(alloc, x, y);
|
|
||||||
cell.* = self.cursor.pen;
|
|
||||||
cell.char = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
.below => {
|
.below => {
|
||||||
|
Reference in New Issue
Block a user