feat(debug): render debug support
This commit is contained in:
@@ -52,8 +52,17 @@ pub fn Element(Event: type) type {
|
||||
/// Otherwise user specific errors should be caught using the `handle`
|
||||
/// function before the rendering of the `Container` happens.
|
||||
pub inline fn content(this: @This(), cells: []Cell, size: Point) !void {
|
||||
if (this.vtable.content) |content_fn|
|
||||
if (this.vtable.content) |content_fn| {
|
||||
try content_fn(this.ptr, cells, size);
|
||||
|
||||
// DEBUG render corresponding top left corner of this `Element` *red*
|
||||
// - only rendered if the corresponding associated element renders contents into the `Container`
|
||||
if (comptime build_options.debug) {
|
||||
cells[0].style.fg = .red;
|
||||
cells[0].style.bg = .black;
|
||||
cells[0].cp = 'e'; // 'e' for *element*
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -260,6 +269,7 @@ pub fn Scrollable(Event: type) type {
|
||||
|
||||
const std = @import("std");
|
||||
const assert = std.debug.assert;
|
||||
const build_options = @import("build_options");
|
||||
const input = @import("input.zig");
|
||||
const Container = @import("container.zig").Container;
|
||||
const Cell = @import("cell.zig");
|
||||
|
||||
Reference in New Issue
Block a user