╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭─────────────────────────────────────────────╮ │186 }; │ │189 - errdefer self.deinit(); │ │187 + errdefer self.deinit(allocator);│ │188 return self; │ │189 } │ │190 │ ╰─────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │193 - pub fn deinit(self: *SelectableList) void { │ │194 - self.scroll.deinit(); │ │195 - for (self.lines.items) |line| self.allocator.free(line); │ │196 - self.lines.deinit(self.allocator); │ │191 + pub fn deinit(self: *SelectableList, allocator: std.mem.Allocator) void { │ │192 + self.scroll.deinit(allocator); │ │193 + for (self.lines.items) |line| allocator.free(line); │ │194 + self.lines.deinit(allocator); │ │195 } │ │196 │ │199 - pub fn setItems(self: *SelectableList, items: []const []const u8) !void { │ │197 + pub fn setItems(self: *SelectableList, allocator: std.mem.Allocator, items: []const []const u8) !void {│ │198 const inner_box = &self.scroll.child.box; │ │199 │ │200 for (inner_box.children.values()) |*child| { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────╮ │203 - child.widget.deinit(); │ │201 + child.widget.deinit(allocator); │ │202 } │ │205 - inner_box.children.clearAndFree(self.allocator); │ │203 + inner_box.children.clearAndFree(allocator); │ │204 │ │207 - for (self.lines.items) |line| self.allocator.free(line);│ │208 - self.lines.clearAndFree(self.allocator); │ │205 + for (self.lines.items) |line| allocator.free(line); │ │206 + self.lines.clearAndFree(allocator); │ │207 │ │208 self.scroll.x = 0; │ │209 self.scroll.y = 0; │ ╰─────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │215 inner_box.getFocus().child_id = null; │ │216 │ │217 for (items) |item| { │ │220 - const line = try self.allocator.dupe(u8, item); │ │218 + const line = try allocator.dupe(u8, item); │ │219 { │ │222 - errdefer self.allocator.free(line); │ │223 - try self.lines.append(self.allocator, line); │ │220 + errdefer allocator.free(line); │ │221 + try self.lines.append(allocator, line); │ │222 } │ │223 │ │226 - var text_box = try wgt.TextBox(Widget).init(self.allocator, line, .{ .border_style = .hidden, .rounded_corners = true, .wrap_kind = .none });│ │227 - errdefer text_box.deinit(); │ │224 + var text_box = try wgt.TextBox(Widget).init(allocator, line, .{ .border_style = .hidden, .rounded_corners = true, .wrap_kind = .none }); │ │225 + errdefer text_box.deinit(allocator); │ │226 text_box.getFocus().focusable = true; │ │229 - try inner_box.children.put(self.allocator, text_box.getFocus().id, .{ .widget = .{ .text_box = text_box }, .rect = null, .min_size = null });│ │227 + try inner_box.children.put(allocator, text_box.getFocus().id, .{ .widget = .{ .text_box = text_box }, .rect = null, .min_size = null }); │ │228 try inner_box.getFocus().addChild(text_box.getFocus(), .{ .width = 0, .height = 0 }, 0, 0); │ │229 } │ │230 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │233 } │ │234 } │ │235 │ │238 - pub fn build(self: *SelectableList, constraint: layout.Constraint, root_focus: *Focus) !void { │ │236 + pub fn build(self: *SelectableList, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) !void {│ │237 self.clearGrid(); │ │238 const children = &self.scroll.child.box.children; │ │239 for (children.keys(), children.values()) |id, *item| { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │242 else │ │243 .hidden; │ │244 } │ │247 - try self.scroll.build(constraint, root_focus); │ │245 + try self.scroll.build(allocator, constraint, root_focus); │ │246 } │ │247 │ │250 - pub fn input(self: *SelectableList, key: inp.Key, root_focus: *Focus) !void { │ │248 + pub fn input(self: *SelectableList, allocator: std.mem.Allocator, key: inp.Key, root_focus: *Focus) !void {│ │249 + _ = allocator; │ │250 if (self.getFocus().child_id) |child_id| { │ │251 const children = &self.scroll.child.box.children; │ │252 if (children.getIndex(child_id)) |current_index| { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │336 // used inside Box(horiz) with a min_size so the box reserves space for the│ │337 // children that follow, pushing them to the right. │ │338 pub const Spacer = struct { │ │340 - allocator: std.mem.Allocator, │ │339 focus: Focus, │ │340 grid: ?Grid, │ │341 │ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────╮ │342 pub fn init(allocator: std.mem.Allocator) Spacer { │ │343 return .{ │ │346 - .allocator = allocator, │ │344 .focus = Focus.init(allocator, .container),│ │345 .grid = null, │ │346 }; │ ╰────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────╮ │347 } │ │348 │ │352 - pub fn deinit(self: *Spacer) void { │ │349 + pub fn deinit(self: *Spacer, allocator: std.mem.Allocator) void {│ │350 + _ = allocator; │ │351 self.focus.deinit(); │ │352 if (self.grid) |*grid| { │ │353 grid.deinit(); │ ╰──────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │355 } │ │356 } │ │357 │ │360 - pub fn build(self: *Spacer, constraint: layout.Constraint, root_focus: *Focus) !void { │ │358 + pub fn build(self: *Spacer, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) !void {│ │359 _ = root_focus; │ │360 self.clearGrid(); │ │361 const width = constraint.max_size.width orelse return; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯