window: add some doc comments

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
This commit is contained in:
Tim Culverhouse 2024-01-19 10:21:49 -06:00
parent 9029055de0
commit 959ae27c9f
2 changed files with 8 additions and 2 deletions

View file

@ -1,4 +1,5 @@
const std = @import("std"); const std = @import("std");
const assert = std.debug.assert;
const Cell = @import("cell.zig").Cell; const Cell = @import("cell.zig").Cell;
@ -38,6 +39,6 @@ pub fn writeCell(self: *Screen, cell: Cell, row: usize, col: usize) void {
return; return;
} }
const i = (col * self.width) + row; const i = (col * self.width) + row;
std.debug.assert(i < self.buf.len); assert(i < self.buf.len);
self.buf[i] = cell; self.buf[i] = cell;
} }

View file

@ -10,15 +10,20 @@ pub const Size = union(enum) {
limit: usize, limit: usize,
}; };
/// horizontal offset from the screen
x_off: usize, x_off: usize,
/// vertical offset from the screen
y_off: usize, y_off: usize,
/// width of the window. This can't be larger than the terminal screen
width: usize, width: usize,
/// height of the window. This can't be larger than the terminal screen
height: usize, height: usize,
screen: *Screen, screen: *Screen,
/// Creates a new window with offset relative to parent and size clamped to the /// 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( pub fn initChild(
self: *Window, self: *Window,
x_off: usize, x_off: usize,