From 959ae27c9fe49dfd8830977c9ba8af41ae904584 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Fri, 19 Jan 2024 10:21:49 -0600 Subject: [PATCH] window: add some doc comments Signed-off-by: Tim Culverhouse --- src/Screen.zig | 3 ++- src/Window.zig | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Screen.zig b/src/Screen.zig index 1a6641d..2ef3da5 100644 --- a/src/Screen.zig +++ b/src/Screen.zig @@ -1,4 +1,5 @@ const std = @import("std"); +const assert = std.debug.assert; const Cell = @import("cell.zig").Cell; @@ -38,6 +39,6 @@ pub fn writeCell(self: *Screen, cell: Cell, row: usize, col: usize) void { return; } const i = (col * self.width) + row; - std.debug.assert(i < self.buf.len); + assert(i < self.buf.len); self.buf[i] = cell; } diff --git a/src/Window.zig b/src/Window.zig index de1d128..3861651 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -10,15 +10,20 @@ pub const Size = union(enum) { limit: usize, }; +/// horizontal offset from the screen x_off: usize, +/// vertical offset from the screen y_off: usize, +/// width of the window. This can't be larger than the terminal screen width: usize, +/// height of the window. This can't be larger than the terminal screen height: usize, screen: *Screen, /// Creates a new window with offset relative to parent and size clamped to the -/// parents' size +/// parent's size. Windows do not retain a reference to their parent and are +/// unaware of resizes. pub fn initChild( self: *Window, x_off: usize,