mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
terminal/new: decaln manages memory
This commit is contained in:
@ -1723,8 +1723,6 @@ pub fn eraseDisplay(
|
||||
///
|
||||
/// Sets the cursor to the top left corner.
|
||||
pub fn decaln(self: *Terminal) !void {
|
||||
// TODO: erase display to gc graphemes, styles
|
||||
|
||||
// Clear our stylistic attributes. This is the only thing that can
|
||||
// fail so we do it first so we can undo it.
|
||||
const old_style = self.screen.cursor.style;
|
||||
@ -1751,13 +1749,15 @@ pub fn decaln(self: *Terminal) !void {
|
||||
// Move our cursor to the top-left
|
||||
self.setCursorPos(1, 1);
|
||||
|
||||
// Erase the display which will deallocate graphames, styles, etc.
|
||||
self.eraseDisplay(.complete, false);
|
||||
|
||||
// Fill with Es, does not move cursor.
|
||||
// TODO: cursor across pages
|
||||
var page = &self.screen.cursor.page_offset.page.data;
|
||||
const rows: [*]Row = @ptrCast(self.screen.cursor.page_row);
|
||||
for (0..self.rows) |y| {
|
||||
const row: *Row = @ptrCast(rows + y);
|
||||
const cells = page.getCells(row);
|
||||
var it = self.screen.pages.rowChunkIterator(.{ .active = .{} }, null);
|
||||
while (it.next()) |chunk| {
|
||||
for (chunk.rows()) |*row| {
|
||||
const cells_multi: [*]Cell = row.cells.ptr(chunk.page.data.memory);
|
||||
const cells = cells_multi[0..self.cols];
|
||||
@memset(cells, .{
|
||||
.content_tag = .codepoint,
|
||||
.content = .{ .codepoint = 'E' },
|
||||
@ -1772,6 +1772,7 @@ pub fn decaln(self: *Terminal) !void {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Set a style attribute.
|
||||
pub fn setAttribute(self: *Terminal, attr: sgr.Attribute) !void {
|
||||
|
Reference in New Issue
Block a user