e6c8be4bd6
As a pretty large optimization, use the provided width when possible to avoid measuring glyphs each render Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
52 lines
1.2 KiB
Zig
52 lines
1.2 KiB
Zig
pub const Cell = struct {
|
|
char: Character = .{},
|
|
style: Style = .{},
|
|
link: Hyperlink = .{},
|
|
};
|
|
|
|
pub const Character = struct {
|
|
grapheme: []const u8 = " ",
|
|
/// width should only be provided when the application is sure the terminal
|
|
/// will meeasure the same width. This can be ensure by using the gwidth method
|
|
/// included in libvaxis. If width is 0, libvaxis will measure the glyph at
|
|
/// render time
|
|
width: usize = 1,
|
|
};
|
|
|
|
pub const Hyperlink = struct {
|
|
uri: []const u8 = "",
|
|
/// ie "id=app-1234"
|
|
params: []const u8 = "",
|
|
};
|
|
|
|
pub const Style = struct {
|
|
pub const Underline = enum {
|
|
off,
|
|
single,
|
|
double,
|
|
curly,
|
|
dotted,
|
|
dashed,
|
|
};
|
|
|
|
fg: Color = .default,
|
|
bg: Color = .default,
|
|
ul: Color = .default,
|
|
ul_style: Underline = .off,
|
|
// TODO: url should maybe go outside of style. We'll need to allocate these
|
|
// in the internal screen
|
|
|
|
bold: bool = false,
|
|
dim: bool = false,
|
|
italic: bool = false,
|
|
blink: bool = false,
|
|
reverse: bool = false,
|
|
invisible: bool = false,
|
|
strikethrough: bool = false,
|
|
};
|
|
|
|
pub const Color = union(enum) {
|
|
default,
|
|
index: u8,
|
|
rgb: [3]u8,
|
|
};
|