2024-01-30 23:26:35 +01:00
|
|
|
const Image = @import("Image.zig");
|
|
|
|
|
2024-02-11 19:59:33 +01:00
|
|
|
char: Character = .{},
|
|
|
|
style: Style = .{},
|
|
|
|
link: Hyperlink = .{},
|
|
|
|
image: ?Image.Placement = null,
|
2024-01-19 04:02:17 +01:00
|
|
|
|
2024-02-01 02:13:56 +01:00
|
|
|
/// Segment is a contiguous run of text that has a constant style
|
|
|
|
pub const Segment = struct {
|
|
|
|
text: []const u8,
|
|
|
|
style: Style = .{},
|
|
|
|
link: Hyperlink = .{},
|
|
|
|
};
|
|
|
|
|
2024-01-19 04:02:17 +01:00
|
|
|
pub const Character = struct {
|
2024-01-19 18:02:32 +01:00
|
|
|
grapheme: []const u8 = " ",
|
2024-01-29 05:42:51 +01:00
|
|
|
/// width should only be provided when the application is sure the terminal
|
2024-02-11 19:59:33 +01:00
|
|
|
/// will measure the same width. This can be ensure by using the gwidth method
|
2024-01-29 05:42:51 +01:00
|
|
|
/// included in libvaxis. If width is 0, libvaxis will measure the glyph at
|
|
|
|
/// render time
|
2024-01-19 18:02:32 +01:00
|
|
|
width: usize = 1,
|
2024-01-19 04:02:17 +01:00
|
|
|
};
|
|
|
|
|
2024-04-15 14:14:31 +02:00
|
|
|
pub const CursorShape = enum {
|
|
|
|
default,
|
|
|
|
block_blink,
|
|
|
|
block,
|
|
|
|
underline_blink,
|
|
|
|
underline,
|
|
|
|
beam_blink,
|
|
|
|
beam,
|
|
|
|
};
|
|
|
|
|
2024-01-25 02:04:12 +01:00
|
|
|
pub const Hyperlink = struct {
|
|
|
|
uri: []const u8 = "",
|
|
|
|
/// ie "id=app-1234"
|
|
|
|
params: []const u8 = "",
|
|
|
|
};
|
|
|
|
|
2024-01-19 04:02:17 +01:00
|
|
|
pub const Style = struct {
|
2024-01-19 06:17:57 +01:00
|
|
|
pub const Underline = enum {
|
|
|
|
off,
|
|
|
|
single,
|
|
|
|
double,
|
|
|
|
curly,
|
|
|
|
dotted,
|
|
|
|
dashed,
|
|
|
|
};
|
|
|
|
|
2024-01-19 04:02:17 +01:00
|
|
|
fg: Color = .default,
|
|
|
|
bg: Color = .default,
|
|
|
|
ul: Color = .default,
|
2024-01-19 06:17:57 +01:00
|
|
|
ul_style: Underline = .off,
|
2024-01-20 02:43:35 +01:00
|
|
|
|
|
|
|
bold: bool = false,
|
|
|
|
dim: bool = false,
|
|
|
|
italic: bool = false,
|
|
|
|
blink: bool = false,
|
|
|
|
reverse: bool = false,
|
|
|
|
invisible: bool = false,
|
|
|
|
strikethrough: bool = false,
|
2024-01-19 04:02:17 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
pub const Color = union(enum) {
|
|
|
|
default,
|
|
|
|
index: u8,
|
|
|
|
rgb: [3]u8,
|
|
|
|
};
|