window: add readCell method

This commit is contained in:
CJ van den Berg 2024-05-08 12:58:36 +02:00 committed by Tim Culverhouse
parent bb5d79ef75
commit cde85103a1

View file

@ -194,6 +194,13 @@ pub fn writeCell(self: Window, col: usize, row: usize, cell: Cell) void {
self.screen.writeCell(col + self.x_off, row + self.y_off, cell); self.screen.writeCell(col + self.x_off, row + self.y_off, cell);
} }
/// reads a cell at the location in the window
pub fn readCell(self: Window, col: usize, row: usize) ?Cell {
if (self.height == 0 or self.width == 0) return null;
if (self.height <= row or self.width <= col) return null;
return self.screen.readCell(col + self.x_off, row + self.y_off);
}
/// fills the window with the default cell /// fills the window with the default cell
pub fn clear(self: Window) void { pub fn clear(self: Window) void {
self.fill(.{ .default = true }); self.fill(.{ .default = true });