╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │29 │ │30 pub fn run(io: std.Io, allocator: std.mem.Allocator, page: *const Page, session: *Session) !void {│ │31 var root = try initRoot(allocator, page, session); │ │32 - defer root.deinit(); │ │32 + defer root.deinit(allocator); │ │33 │ │34 var terminal = try term.Terminal.init(io, allocator); │ │35 defer terminal.deinit(io); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────╮ │53 // there may be an animation that requires more looping.│ │54 var blocking = !grid_changed; │ │55 while (try terminal.readKey(io, blocking)) |key| { │ │56 - try inputKey(&root, key, &terminal); │ │56 + try inputKey(allocator, &root, key, &terminal); │ │57 blocking = false; │ │58 } │ │59 │ ╰────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────╮ │60 - try root.build(.{ │ │60 + try root.build(allocator, .{ │ │61 .min_size = .{ .width = null, .height = null }, │ │62 .max_size = .{ .width = last_size.width, .height = last_size.height },│ │63 }, root.getFocus()); │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │64 } │ │65 } │ │66 │ │67 -pub fn inputKey(root: *Widget, key: inp.Key, terminal: anytype) !void { │ │67 +pub fn inputKey(allocator: std.mem.Allocator, root: *Widget, key: inp.Key, terminal: anytype) !void { │ │68 switch (key) { │ │69 - .codepoint => |cp| if (cp == 'q') terminal.requestQuit() else try root.input(key, root.getFocus()), │ │69 + .codepoint => |cp| if (cp == 'q') terminal.requestQuit() else try root.input(allocator, key, root.getFocus()),│ │70 .mouse => |mouse| { │ │71 if (mouse.action == .press and mouse.action.press == .left) { │ │72 const root_focus = root.getFocus(); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │85 // forward the press into the widget tree so buttons (and any│ │86 // future click-aware widgets) can react. widgets that don't │ │87 // care about presses ignore it. │ │88 - try root.input(key, root.getFocus()); │ │88 + try root.input(allocator, key, root.getFocus()); │ │89 } else { │ │90 - try root.input(key, root.getFocus()); │ │90 + try root.input(allocator, key, root.getFocus()); │ │91 } │ │92 }, │ │93 - else => try root.input(key, root.getFocus()), │ │93 + else => try root.input(allocator, key, root.getFocus()), │ │94 } │ │95 } │ │96 │ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │ 98 var root: Widget = switch (page.*) { │ │ 99 .home => |*p| .{ .home = try Home.View.init(allocator, p, session) },│ │100 }; │ │101 - errdefer root.deinit(); │ │101 + errdefer root.deinit(allocator); │ │102 │ │103 - try root.build(.{ │ │103 + try root.build(allocator, .{ │ │104 .min_size = .{ .width = null, .height = null }, │ │105 .max_size = .{ .width = 80, .height = null }, │ │106 }, root.getFocus()); │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────╮ │128 home_auth_tab: Home.Header.AuthTab.View, │ │129 home_auth: Home.Auth.View, │ │130 │ │131 - pub fn deinit(self: *Widget) void { │ │131 + pub fn deinit(self: *Widget, allocator: std.mem.Allocator) void {│ │132 switch (self.*) { │ │133 - inline else => |*case| case.deinit(), │ │133 + inline else => |*case| case.deinit(allocator), │ │134 } │ │135 } │ │136 │ ╰──────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │137 - pub fn build(self: *Widget, constraint: layout.Constraint, root_focus: *Focus) anyerror!void { │ │137 + pub fn build(self: *Widget, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) anyerror!void {│ │138 switch (self.*) { │ │139 - inline else => |*case| try case.build(constraint, root_focus), │ │139 + inline else => |*case| try case.build(allocator, constraint, root_focus), │ │140 } │ │141 } │ │142 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │143 - pub fn input(self: *Widget, key: inp.Key, root_focus: *Focus) anyerror!void { │ │143 + pub fn input(self: *Widget, allocator: std.mem.Allocator, key: inp.Key, root_focus: *Focus) anyerror!void {│ │144 switch (self.*) { │ │145 - inline else => |*case| try case.input(key, root_focus), │ │145 + inline else => |*case| try case.input(allocator, key, root_focus), │ │146 } │ │147 } │ │148 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │168 // a scrollable list of selectable single-line items. content is replaced │ │169 // via setItems, which dupes the strings into the widget's own allocation.│ │170 pub const SelectableList = struct { │ │171 - allocator: std.mem.Allocator, │ │171 scroll: wgt.Scroll(Widget), │ │172 lines: std.ArrayList([]const u8), │ │173 │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯