···99Libvaxis _does not use terminfo_. Support for vt features is detected through
1010terminal queries.
11111212-Vaxis uses zig `0.15.1`.
1212+Vaxis uses zig `0.16.0`.
13131414## Features
1515···277277 foo: u8,
278278};
279279280280-pub fn main() !void {
281281- var gpa = std.heap.GeneralPurposeAllocator(.{}){};
282282- defer {
283283- const deinit_status = gpa.deinit();
284284- //fail test; can't try in defer as defer is executed after we return
285285- if (deinit_status == .leak) {
286286- std.log.err("memory leak", .{});
287287- }
288288- }
289289- const alloc = gpa.allocator();
280280+pub fn main(init: std.process.Init) !void {
281281+ const io = init.io;
282282+ const alloc = init.gpa;
290283291284 // Initialize a tty
292285 var buffer: [1024]u8 = undefined;
293293- var tty = try vaxis.Tty.init(&buffer);
286286+ var tty = try vaxis.Tty.init(io, &buffer);
294287 defer tty.deinit();
295288296289 // Initialize Vaxis
297297- var vx = try vaxis.init(alloc, .{});
290290+ var vx = try vaxis.init(io, alloc, init.environ_map, .{});
298291 // deinit takes an optional allocator. If your program is exiting, you can
299292 // choose to pass a null allocator to save some exit time.
300293 defer vx.deinit(alloc, tty.writer());
···305298 // installs a signal handler for SIGWINCH on posix TTYs
306299 //
307300 // This event loop is thread safe. It reads the tty in a separate thread
308308- var loop: vaxis.Loop(Event) = .{
309309- .tty = &tty,
310310- .vaxis = &vx,
311311- };
312312- try loop.init();
301301+ var loop: vaxis.Loop(Event) = .init(io, &tty, &vx);
313302314303 // Start the read loop. This puts the terminal in raw mode and begins
315304 // reading user input
+11
build.zig
···110110 }),
111111 });
112112113113+ // Let's make sure that all of the examples compile and can run any tests
114114+ // that they may have defined.
115115+ var it = examples.iterator();
116116+ while (it.next()) |v| {
117117+ const e = b.addTest(.{
118118+ .root_module = v.value.*,
119119+ });
120120+ const r = b.addRunArtifact(e);
121121+ tests_step.dependOn(&r.step);
122122+ }
123123+113124 const tests_run = b.addRunArtifact(tests);
114125 b.installArtifact(tests);
115126 tests_step.dependOn(&tests_run.step);
···37373838/// If Border has a bounded maximum size, it will shrink the maximum size to account for the border
3939/// before drawing the child. If the size is unbounded, border will draw the child and then itself
4040-/// around the childs size
4040+/// around the child's size
4141pub fn draw(self: *const Border, ctx: vxfw.DrawContext) Allocator.Error!vxfw.Surface {
4242 const max_width: ?u16 = if (ctx.max.width) |width| width -| 2 else null;
4343 const max_height: ?u16 = if (ctx.max.height) |height| height -| 2 else null;