fix examples, update readme features
This commit is contained in:
parent
d7bc2c451b
commit
1b957ec84e
10 changed files with 27 additions and 33 deletions
|
@ -25,7 +25,7 @@ Vaxis uses zig `0.12.0`.
|
||||||
| Kitty Keyboard | ✅ | ✅ | ✅ |
|
| Kitty Keyboard | ✅ | ✅ | ✅ |
|
||||||
| Styled Underlines | ✅ | ✅ | ✅ |
|
| Styled Underlines | ✅ | ✅ | ✅ |
|
||||||
| Mouse Shapes (OSC 22) | ✅ | ✅ | ❌ |
|
| Mouse Shapes (OSC 22) | ✅ | ✅ | ❌ |
|
||||||
| System Clipboard (OSC 52) | ✅ | planned | ❌ |
|
| System Clipboard (OSC 52) | ✅ | ✅ | ❌ |
|
||||||
| System Notifications (OSC 9) | ✅ | ✅ | ❌ |
|
| System Notifications (OSC 9) | ✅ | ✅ | ❌ |
|
||||||
| System Notifications (OSC 777) | ✅ | ✅ | ❌ |
|
| System Notifications (OSC 777) | ✅ | ✅ | ❌ |
|
||||||
| Synchronized Output (DEC 2026) | ✅ | ✅ | ✅ |
|
| Synchronized Output (DEC 2026) | ✅ | ✅ | ✅ |
|
||||||
|
@ -35,7 +35,7 @@ Vaxis uses zig `0.12.0`.
|
||||||
| Images (half block) | ✅ | planned | ✅ |
|
| Images (half block) | ✅ | planned | ✅ |
|
||||||
| Images (quadrant) | ✅ | planned | ✅ |
|
| Images (quadrant) | ✅ | planned | ✅ |
|
||||||
| Images (sextant) | ❌ | ❌ | ✅ |
|
| Images (sextant) | ❌ | ❌ | ✅ |
|
||||||
| Images (sixel) | ✅ | debating | ✅ |
|
| Images (sixel) | ✅ | ❌ | ✅ |
|
||||||
| Images (kitty) | ✅ | ✅ | ✅ |
|
| Images (kitty) | ✅ | ✅ | ✅ |
|
||||||
| Images (iterm2) | ❌ | ❌ | ✅ |
|
| Images (iterm2) | ❌ | ❌ | ✅ |
|
||||||
| Video | ❌ | ❌ | ✅ |
|
| Video | ❌ | ❌ | ✅ |
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub fn main() !void {
|
||||||
|
|
||||||
var loop: vaxis.Loop(Event) = .{ .vaxis = &vx };
|
var loop: vaxis.Loop(Event) = .{ .vaxis = &vx };
|
||||||
|
|
||||||
try loop.run(alloc);
|
try loop.run();
|
||||||
defer loop.stop();
|
defer loop.stop();
|
||||||
|
|
||||||
try vx.queryTerminal();
|
try vx.queryTerminal();
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub fn main() !void {
|
||||||
|
|
||||||
var loop: vaxis.Loop(Event) = .{ .vaxis = &vx };
|
var loop: vaxis.Loop(Event) = .{ .vaxis = &vx };
|
||||||
|
|
||||||
try loop.run(alloc);
|
try loop.run();
|
||||||
defer loop.stop();
|
defer loop.stop();
|
||||||
|
|
||||||
try vx.enterAltScreen();
|
try vx.enterAltScreen();
|
||||||
|
|
|
@ -22,7 +22,7 @@ pub fn main() !void {
|
||||||
|
|
||||||
// Start the read loop. This puts the terminal in raw mode and begins
|
// Start the read loop. This puts the terminal in raw mode and begins
|
||||||
// reading user input
|
// reading user input
|
||||||
try loop.run(alloc);
|
try loop.run();
|
||||||
defer loop.stop();
|
defer loop.stop();
|
||||||
|
|
||||||
// Optionally enter the alternate screen
|
// Optionally enter the alternate screen
|
||||||
|
|
|
@ -29,7 +29,7 @@ pub fn main() !void {
|
||||||
|
|
||||||
var loop: vaxis.Loop(Event) = .{ .vaxis = &vx };
|
var loop: vaxis.Loop(Event) = .{ .vaxis = &vx };
|
||||||
|
|
||||||
try loop.run(alloc);
|
try loop.run();
|
||||||
defer loop.stop();
|
defer loop.stop();
|
||||||
|
|
||||||
// Optionally enter the alternate screen
|
// Optionally enter the alternate screen
|
||||||
|
|
|
@ -16,7 +16,7 @@ pub fn main() !void {
|
||||||
|
|
||||||
var loop: vaxis.Loop(Event) = .{ .vaxis = &vx };
|
var loop: vaxis.Loop(Event) = .{ .vaxis = &vx };
|
||||||
|
|
||||||
try loop.run(alloc);
|
try loop.run();
|
||||||
defer loop.stop();
|
defer loop.stop();
|
||||||
try vx.enterAltScreen();
|
try vx.enterAltScreen();
|
||||||
try vx.queryTerminal();
|
try vx.queryTerminal();
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub fn main() !void {
|
||||||
|
|
||||||
var loop: vaxis.Loop(Event) = .{ .vaxis = &vx };
|
var loop: vaxis.Loop(Event) = .{ .vaxis = &vx };
|
||||||
|
|
||||||
try loop.run(alloc);
|
try loop.run();
|
||||||
defer loop.stop();
|
defer loop.stop();
|
||||||
|
|
||||||
try vx.queryTerminal();
|
try vx.queryTerminal();
|
||||||
|
|
|
@ -32,7 +32,7 @@ pub fn main() !void {
|
||||||
winsize: vaxis.Winsize,
|
winsize: vaxis.Winsize,
|
||||||
}) = .{ .vaxis = &vx };
|
}) = .{ .vaxis = &vx };
|
||||||
|
|
||||||
try loop.run(alloc);
|
try loop.run();
|
||||||
defer loop.stop();
|
defer loop.stop();
|
||||||
try vx.enterAltScreen();
|
try vx.enterAltScreen();
|
||||||
try vx.queryTerminal();
|
try vx.queryTerminal();
|
||||||
|
@ -94,10 +94,9 @@ pub fn main() !void {
|
||||||
break :keyEvt;
|
break :keyEvt;
|
||||||
}
|
}
|
||||||
// Command State
|
// Command State
|
||||||
if (
|
if (active != .btm and
|
||||||
active != .btm and
|
key.matchesAny(&.{ ':', '/', 'g', 'G' }, .{}))
|
||||||
key.matchesAny(&.{ ':', '/', 'g', 'G' }, .{})
|
{
|
||||||
) {
|
|
||||||
active = .btm;
|
active = .btm;
|
||||||
for (0..cmd_input.buf.items.len) |_| _ = cmd_input.buf.orderedRemove(0);
|
for (0..cmd_input.buf.items.len) |_| _ = cmd_input.buf.orderedRemove(0);
|
||||||
try cmd_input.update(.{ .key_press = key });
|
try cmd_input.update(.{ .key_press = key });
|
||||||
|
@ -127,11 +126,9 @@ pub fn main() !void {
|
||||||
// Run Command and Clear Command Bar
|
// Run Command and Clear Command Bar
|
||||||
else if (key.matchExact(vaxis.Key.enter, .{})) {
|
else if (key.matchExact(vaxis.Key.enter, .{})) {
|
||||||
const cmd = cmd_input.buf.items;
|
const cmd = cmd_input.buf.items;
|
||||||
if (
|
if (mem.eql(u8, ":q", cmd) or
|
||||||
mem.eql(u8, ":q", cmd) or
|
|
||||||
mem.eql(u8, ":quit", cmd) or
|
mem.eql(u8, ":quit", cmd) or
|
||||||
mem.eql(u8, ":exit", cmd)
|
mem.eql(u8, ":exit", cmd)) return;
|
||||||
) return;
|
|
||||||
if (mem.eql(u8, "G", cmd)) {
|
if (mem.eql(u8, "G", cmd)) {
|
||||||
demo_tbl.row = user_list.items.len - 1;
|
demo_tbl.row = user_list.items.len - 1;
|
||||||
active = .mid;
|
active = .mid;
|
||||||
|
@ -143,8 +140,7 @@ pub fn main() !void {
|
||||||
}
|
}
|
||||||
for (0..cmd_input.buf.items.len) |_| _ = cmd_input.buf.orderedRemove(0);
|
for (0..cmd_input.buf.items.len) |_| _ = cmd_input.buf.orderedRemove(0);
|
||||||
cmd_input.cursor_idx = 0;
|
cmd_input.cursor_idx = 0;
|
||||||
}
|
} else try cmd_input.update(.{ .key_press = key });
|
||||||
else try cmd_input.update(.{ .key_press = key });
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
moving = false;
|
moving = false;
|
||||||
|
@ -168,15 +164,15 @@ pub fn main() !void {
|
||||||
);
|
);
|
||||||
for (title_segs[0..]) |*title_seg|
|
for (title_segs[0..]) |*title_seg|
|
||||||
title_seg.*.style.bg = if (active == .top) selected_bg else other_bg;
|
title_seg.*.style.bg = if (active == .top) selected_bg else other_bg;
|
||||||
top_bar.fill(.{
|
top_bar.fill(.{ .style = .{
|
||||||
.style = .{ .bg = if (active == .top) selected_bg else other_bg, }
|
.bg = if (active == .top) selected_bg else other_bg,
|
||||||
});
|
} });
|
||||||
const logo_bar = vaxis.widgets.alignment.center(
|
const logo_bar = vaxis.widgets.alignment.center(
|
||||||
top_bar,
|
top_bar,
|
||||||
44,
|
44,
|
||||||
top_bar.height - (top_bar.height / 3),
|
top_bar.height - (top_bar.height / 3),
|
||||||
);
|
);
|
||||||
try logo_bar.wrap(title_segs[0..]);
|
_ = try logo_bar.print(title_segs[0..], .{ .wrap = .word });
|
||||||
|
|
||||||
// - Middle
|
// - Middle
|
||||||
const middle_bar = win.initChild(
|
const middle_bar = win.initChild(
|
||||||
|
@ -203,9 +199,7 @@ pub fn main() !void {
|
||||||
.{ .limit = win.width },
|
.{ .limit = win.width },
|
||||||
.{ .limit = 1 },
|
.{ .limit = 1 },
|
||||||
);
|
);
|
||||||
if (active == .btm) bottom_bar.fill(.{
|
if (active == .btm) bottom_bar.fill(.{ .style = .{ .bg = selected_bg } });
|
||||||
.style = .{ .bg = selected_bg }
|
|
||||||
});
|
|
||||||
cmd_input.draw(bottom_bar);
|
cmd_input.draw(bottom_bar);
|
||||||
|
|
||||||
// Render the screen
|
// Render the screen
|
||||||
|
|
|
@ -42,7 +42,7 @@ pub fn main() !void {
|
||||||
|
|
||||||
// Start the read loop. This puts the terminal in raw mode and begins
|
// Start the read loop. This puts the terminal in raw mode and begins
|
||||||
// reading user input
|
// reading user input
|
||||||
try loop.run(alloc);
|
try loop.run();
|
||||||
defer loop.stop();
|
defer loop.stop();
|
||||||
|
|
||||||
// Optionally enter the alternate screen
|
// Optionally enter the alternate screen
|
||||||
|
@ -85,7 +85,7 @@ pub fn main() !void {
|
||||||
loop.stop();
|
loop.stop();
|
||||||
var child = std.process.Child.init(&.{"nvim"}, alloc);
|
var child = std.process.Child.init(&.{"nvim"}, alloc);
|
||||||
_ = try child.spawnAndWait();
|
_ = try child.spawnAndWait();
|
||||||
try loop.run(alloc);
|
try loop.run();
|
||||||
try vx.enterAltScreen();
|
try vx.enterAltScreen();
|
||||||
vx.queueRefresh();
|
vx.queueRefresh();
|
||||||
} else if (key.matches(vaxis.Key.enter, .{})) {
|
} else if (key.matches(vaxis.Key.enter, .{})) {
|
||||||
|
|
|
@ -84,7 +84,7 @@ pub fn drawTable(
|
||||||
.ul_style = if (idx == table_ctx.col) .single else .dotted,
|
.ul_style = if (idx == table_ctx.col) .single else .dotted,
|
||||||
},
|
},
|
||||||
}};
|
}};
|
||||||
try hdr.wrap(seg[0..]);
|
_ = try hdr.print(seg[0..], .{ .wrap = .word });
|
||||||
}
|
}
|
||||||
|
|
||||||
const max_items = if (data_list.items.len > table_win.height -| 1) table_win.height -| 1 else data_list.items.len;
|
const max_items = if (data_list.items.len > table_win.height -| 1) table_win.height -| 1 else data_list.items.len;
|
||||||
|
@ -120,7 +120,7 @@ pub fn drawTable(
|
||||||
.text = if (data.len > table_ctx.col_width and alloc != null) try fmt.allocPrint(alloc.?, "{s}...", .{data[0..(table_ctx.col_width -| 4)]}) else data,
|
.text = if (data.len > table_ctx.col_width and alloc != null) try fmt.allocPrint(alloc.?, "{s}...", .{data[0..(table_ctx.col_width -| 4)]}) else data,
|
||||||
.style = .{ .bg = row_bg },
|
.style = .{ .bg = row_bg },
|
||||||
}};
|
}};
|
||||||
try row_win.wrap(seg[0..]);
|
_ = try row_win.print(seg[0..], .{ .wrap = .word });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const item_fields = meta.fields(DataT);
|
const item_fields = meta.fields(DataT);
|
||||||
|
@ -157,7 +157,7 @@ pub fn drawTable(
|
||||||
.text = if (item_txt.len > table_ctx.col_width and alloc != null) try fmt.allocPrint(alloc.?, "{s}...", .{item_txt[0..(table_ctx.col_width -| 4)]}) else item_txt,
|
.text = if (item_txt.len > table_ctx.col_width and alloc != null) try fmt.allocPrint(alloc.?, "{s}...", .{item_txt[0..(table_ctx.col_width -| 4)]}) else item_txt,
|
||||||
.style = .{ .bg = row_bg },
|
.style = .{ .bg = row_bg },
|
||||||
}};
|
}};
|
||||||
try item_win.wrap(seg[0..]);
|
_ = try item_win.print(seg[0..], .{ .wrap = .word });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue