Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix usage example in README #18

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub fn main() !void {
const deinit_status = gpa.deinit();
//fail test; can't try in defer as defer is executed after we return
if (deinit_status == .leak) {
log.err("memory leak", .{});
std.log.err("memory leak", .{});
}
}
const alloc = gpa.allocator();
Expand Down Expand Up @@ -109,7 +109,7 @@ pub fn main() !void {
while (true) {
// nextEvent blocks until an event is in the queue
const event = vx.nextEvent();
log.debug("event: {}", .{event});
std.log.debug("event: {}", .{event});
// exhaustive switching ftw. Vaxis will send events if your Event enum
// has the fields for those events (ie "key_press", "winsize")
switch (event) {
Expand Down Expand Up @@ -156,24 +156,24 @@ pub fn main() !void {
// the old and only updated cells will be drawn
win.clear();

// Create a style
// Create a style
const style: vaxis.Style = .{
.fg = .{ .index = color_idx },
};

// Create a bordered child window
const child = win.child(.{
.x_off = win.width / 2 - 20,
.y_off = win.height / 2 - 3,
.width = .{ .limit = 40 },
.height = .{ .limit = 3 },
.border = .{
.where = .all,
.style = .{ .fg = .index = color_idx },
},
})

// Draw the text_input in the child window
// Create a bordered child window
const child = win.child(.{
.x_off = win.width / 2 - 20,
.y_off = win.height / 2 - 3,
.width = .{ .limit = 40 },
.height = .{ .limit = 3 },
.border = .{
.where = .all,
.style = style,
},
});

// Draw the text_input in the child window
text_input.draw(child);

// Render the screen
Expand Down