From cde85103a11b50a12daaece49b9eabcb447165dd Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 8 May 2024 12:58:36 +0200 Subject: [PATCH] window: add readCell method --- src/Window.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Window.zig b/src/Window.zig index 32d9a91..b63ce04 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -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 });