api: export InternalScreen as AllocatingScreen
I'm not thrilled with the name but we'll go with it for now
This commit is contained in:
parent
7ff5251ea3
commit
47160418aa
2 changed files with 18 additions and 0 deletions
|
@ -95,3 +95,20 @@ pub fn writeCell(
|
|||
};
|
||||
self.buf[i].style = cell.style;
|
||||
}
|
||||
|
||||
pub fn readCell(self: *InternalScreen, col: usize, row: usize) ?Cell {
|
||||
if (self.width < col) {
|
||||
// column out of bounds
|
||||
return null;
|
||||
}
|
||||
if (self.height < row) {
|
||||
// height out of bounds
|
||||
return null;
|
||||
}
|
||||
const i = (row * self.width) + col;
|
||||
assert(i < self.buf.len);
|
||||
return .{
|
||||
.char = .{ .grapheme = self.buf[i].char.items },
|
||||
.style = self.buf[i].style,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ pub const Color = Cell.Color;
|
|||
pub const Image = @import("Image.zig");
|
||||
pub const Mouse = @import("Mouse.zig");
|
||||
pub const Screen = @import("Screen.zig");
|
||||
pub const AllocatingScreen = @import("InternalScreen.zig");
|
||||
pub const Winsize = @import("Tty.zig").Winsize;
|
||||
pub const Window = @import("Window.zig");
|
||||
|
||||
|
|
Loading…
Reference in a new issue