Skip to content

Commit

Permalink
window: add readCell method
Browse files Browse the repository at this point in the history
  • Loading branch information
neurocyte authored and rockorager committed May 9, 2024
1 parent bb5d79e commit cde8510
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Window.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/// 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
pub fn clear(self: Window) void {
self.fill(.{ .default = true });
Expand Down

0 comments on commit cde8510

Please sign in to comment.