srctree

Gregory Mullen parent b3fd78e6 6d3b3d12
add helper

feeling lazy, might delete later
src/completion.zig added: 15, removed: 12, total 3
@@ -65,8 +65,8 @@ pub const CompOption = struct {
try std.fmt.format(out, "CompOption{{{s}, {s}}}", .{ self.str, @tagName(self.kind) });
}
 
pub fn style(self: CompOption, active: bool) Draw.Lexeme.Style {
const default = Draw.Lexeme.Style{
pub fn style(self: CompOption, active: bool) Draw.Style {
const default = Draw.Style{
.attr = if (active) .reverse else .reset,
};
if (self.kind == null) return default;
 
src/draw.zig added: 15, removed: 12, total 3
@@ -54,17 +54,20 @@ pub const Color = enum {
green,
};
 
pub const Style = struct {
attr: ?Attr = null,
fg: ?Color = null,
bg: ?Color = null,
 
pub const BoldGreen: Style = .{ .attr = .bold, .fg = .green };
pub const Green: Style = .{ .fg = .green };
};
 
pub const Lexeme = struct {
char: []const u8,
padding: ?Padding = null,
style: ?Style = null,
 
pub const Style = struct {
attr: ?Attr = null,
fg: ?Color = null,
bg: ?Color = null,
};
 
pub const Padding = struct {
char: u8 = ' ',
left: i32 = 0,
 
src/line.zig added: 15, removed: 12, total 3
@@ -249,7 +249,7 @@ fn complete(line: *Line) !void {
line.hsh.draw.clear();
try Draw.drawAfter(&line.hsh.draw, &[_]Draw.Lexeme{.{
.char = "[ char ]",
.style = .{ .attr = .bold, .fg = .green },
.style = Draw.Style.BoldGreen,
}});
try Prompt.draw(line.hsh, line.peek());
try line.hsh.draw.render();