implement erase display scrollback ("clear" command)

This commit is contained in:
Mitchell Hashimoto
2022-08-09 09:22:34 -07:00
parent fb5afbedd2
commit ad1cdbcd59
2 changed files with 9 additions and 5 deletions

View File

@ -116,8 +116,6 @@ pub const RowIndex = union(RowIndexTag) {
/// The index is from the top of the history (scrollback) to just /// The index is from the top of the history (scrollback) to just
/// prior to the active area. /// prior to the active area.
history: usize, history: usize,
// TODO: others
}; };
/// The tags of RowIndex /// The tags of RowIndex

View File

@ -597,9 +597,15 @@ pub fn eraseDisplay(
self.screen.cursor.pending_wrap = false; self.screen.cursor.pending_wrap = false;
}, },
else => { .scrollback => {
log.err("unimplemented display mode: {}", .{mode}); const region = self.screen.region(.history);
@panic("unimplemented"); std.mem.set(Screen.Cell, region[0], self.screen.cursor.pen);
std.mem.set(Screen.Cell, region[1], self.screen.cursor.pen);
// TODO: move this logic to the Screen implementation
self.screen.top = self.screen.visible_offset;
self.screen.bottom = self.screen.bottom - self.screen.visible_offset;
self.screen.visible_offset = 0;
}, },
} }
} }