diff --git a/README.md b/README.md index ab3ea86..3316894 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Vaxis uses zig `0.12.0`. | Kitty Keyboard | ✅ | ✅ | ✅ | | Styled Underlines | ✅ | ✅ | ✅ | | Mouse Shapes (OSC 22) | ✅ | ✅ | ❌ | -| System Clipboard (OSC 52) | ✅ | planned | ❌ | +| System Clipboard (OSC 52) | ✅ | ✅ | ❌ | | System Notifications (OSC 9) | ✅ | ✅ | ❌ | | System Notifications (OSC 777) | ✅ | ✅ | ❌ | | Synchronized Output (DEC 2026) | ✅ | ✅ | ✅ | @@ -35,7 +35,7 @@ Vaxis uses zig `0.12.0`. | Images (half block) | ✅ | planned | ✅ | | Images (quadrant) | ✅ | planned | ✅ | | Images (sextant) | ❌ | ❌ | ✅ | -| Images (sixel) | ✅ | debating | ✅ | +| Images (sixel) | ✅ | ❌ | ✅ | | Images (kitty) | ✅ | ✅ | ✅ | | Images (iterm2) | ❌ | ❌ | ✅ | | Video | ❌ | ❌ | ✅ | diff --git a/examples/cli.zig b/examples/cli.zig index 5ccddfa..c149acb 100644 --- a/examples/cli.zig +++ b/examples/cli.zig @@ -19,7 +19,7 @@ pub fn main() !void { var loop: vaxis.Loop(Event) = .{ .vaxis = &vx }; - try loop.run(alloc); + try loop.run(); defer loop.stop(); try vx.queryTerminal(); diff --git a/examples/image.zig b/examples/image.zig index 60ca807..f8008e0 100644 --- a/examples/image.zig +++ b/examples/image.zig @@ -23,7 +23,7 @@ pub fn main() !void { var loop: vaxis.Loop(Event) = .{ .vaxis = &vx }; - try loop.run(alloc); + try loop.run(); defer loop.stop(); try vx.enterAltScreen(); diff --git a/examples/main.zig b/examples/main.zig index 92428e2..b7537c5 100644 --- a/examples/main.zig +++ b/examples/main.zig @@ -22,7 +22,7 @@ pub fn main() !void { // Start the read loop. This puts the terminal in raw mode and begins // reading user input - try loop.run(alloc); + try loop.run(); defer loop.stop(); // Optionally enter the alternate screen diff --git a/examples/nvim.zig b/examples/nvim.zig index 3ef0fbb..156290d 100644 --- a/examples/nvim.zig +++ b/examples/nvim.zig @@ -29,7 +29,7 @@ pub fn main() !void { var loop: vaxis.Loop(Event) = .{ .vaxis = &vx }; - try loop.run(alloc); + try loop.run(); defer loop.stop(); // Optionally enter the alternate screen diff --git a/examples/pathological.zig b/examples/pathological.zig index 5e1172a..1af65f1 100644 --- a/examples/pathological.zig +++ b/examples/pathological.zig @@ -16,7 +16,7 @@ pub fn main() !void { var loop: vaxis.Loop(Event) = .{ .vaxis = &vx }; - try loop.run(alloc); + try loop.run(); defer loop.stop(); try vx.enterAltScreen(); try vx.queryTerminal(); diff --git a/examples/shell.zig b/examples/shell.zig index f6f51c9..fb0c5df 100644 --- a/examples/shell.zig +++ b/examples/shell.zig @@ -19,7 +19,7 @@ pub fn main() !void { var loop: vaxis.Loop(Event) = .{ .vaxis = &vx }; - try loop.run(alloc); + try loop.run(); defer loop.stop(); try vx.queryTerminal(); diff --git a/examples/table.zig b/examples/table.zig index 30a806d..4b17dba 100644 --- a/examples/table.zig +++ b/examples/table.zig @@ -8,7 +8,7 @@ const vaxis = @import("vaxis"); const log = std.log.scoped(.main); -const ActiveSection = enum{ +const ActiveSection = enum { top, mid, btm, @@ -32,7 +32,7 @@ pub fn main() !void { winsize: vaxis.Winsize, }) = .{ .vaxis = &vx }; - try loop.run(alloc); + try loop.run(); defer loop.stop(); try vx.enterAltScreen(); try vx.queryTerminal(); @@ -94,10 +94,9 @@ pub fn main() !void { break :keyEvt; } // Command State - if ( - active != .btm and - key.matchesAny(&.{ ':', '/', 'g', 'G' }, .{}) - ) { + if (active != .btm and + key.matchesAny(&.{ ':', '/', 'g', 'G' }, .{})) + { active = .btm; for (0..cmd_input.buf.items.len) |_| _ = cmd_input.buf.orderedRemove(0); try cmd_input.update(.{ .key_press = key }); @@ -127,11 +126,9 @@ pub fn main() !void { // Run Command and Clear Command Bar else if (key.matchExact(vaxis.Key.enter, .{})) { const cmd = cmd_input.buf.items; - if ( - mem.eql(u8, ":q", cmd) or + if (mem.eql(u8, ":q", cmd) or mem.eql(u8, ":quit", cmd) or - mem.eql(u8, ":exit", cmd) - ) return; + mem.eql(u8, ":exit", cmd)) return; if (mem.eql(u8, "G", cmd)) { demo_tbl.row = user_list.items.len - 1; active = .mid; @@ -143,8 +140,7 @@ pub fn main() !void { } for (0..cmd_input.buf.items.len) |_| _ = cmd_input.buf.orderedRemove(0); cmd_input.cursor_idx = 0; - } - else try cmd_input.update(.{ .key_press = key }); + } else try cmd_input.update(.{ .key_press = key }); }, } moving = false; @@ -168,15 +164,15 @@ pub fn main() !void { ); for (title_segs[0..]) |*title_seg| title_seg.*.style.bg = if (active == .top) selected_bg else other_bg; - top_bar.fill(.{ - .style = .{ .bg = if (active == .top) selected_bg else other_bg, } - }); + top_bar.fill(.{ .style = .{ + .bg = if (active == .top) selected_bg else other_bg, + } }); const logo_bar = vaxis.widgets.alignment.center( top_bar, 44, top_bar.height - (top_bar.height / 3), ); - try logo_bar.wrap(title_segs[0..]); + _ = try logo_bar.print(title_segs[0..], .{ .wrap = .word }); // - Middle const middle_bar = win.initChild( @@ -203,9 +199,7 @@ pub fn main() !void { .{ .limit = win.width }, .{ .limit = 1 }, ); - if (active == .btm) bottom_bar.fill(.{ - .style = .{ .bg = selected_bg } - }); + if (active == .btm) bottom_bar.fill(.{ .style = .{ .bg = selected_bg } }); cmd_input.draw(bottom_bar); // Render the screen @@ -214,7 +208,7 @@ pub fn main() !void { } /// User Struct -pub const User = struct{ +pub const User = struct { first: []const u8, last: []const u8, user: []const u8, diff --git a/examples/text_input.zig b/examples/text_input.zig index 463c753..36fcdef 100644 --- a/examples/text_input.zig +++ b/examples/text_input.zig @@ -42,7 +42,7 @@ pub fn main() !void { // Start the read loop. This puts the terminal in raw mode and begins // reading user input - try loop.run(alloc); + try loop.run(); defer loop.stop(); // Optionally enter the alternate screen @@ -85,7 +85,7 @@ pub fn main() !void { loop.stop(); var child = std.process.Child.init(&.{"nvim"}, alloc); _ = try child.spawnAndWait(); - try loop.run(alloc); + try loop.run(); try vx.enterAltScreen(); vx.queueRefresh(); } else if (key.matches(vaxis.Key.enter, .{})) { diff --git a/src/widgets/Table.zig b/src/widgets/Table.zig index 25606f8..530ddca 100644 --- a/src/widgets/Table.zig +++ b/src/widgets/Table.zig @@ -84,7 +84,7 @@ pub fn drawTable( .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; @@ -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, .style = .{ .bg = row_bg }, }}; - try row_win.wrap(seg[0..]); + _ = try row_win.print(seg[0..], .{ .wrap = .word }); return; } 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, .style = .{ .bg = row_bg }, }}; - try item_win.wrap(seg[0..]); + _ = try item_win.print(seg[0..], .{ .wrap = .word }); } } }