╭ changed ─────────────╮ │src/ui/Repo/Events.zig│ ╰──────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────╮ │709 } │ │710 │ │711 pub const View = struct { │ │712 - box: wgt.Box(ui.Widget), │ │712 + scroll: ui.widget.HeaderScroll, │ │713 session: *ui.Session, │ │714 tab_ids: [2]usize, │ │715 // the tab stays selected while the sync button has focus│ ╰──────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │717 button_id: ?usize, │ │718 │ │719 pub fn init(allocator: std.mem.Allocator, data: *const Self, session: *ui.Session) !Header.View { │ │720 - var box = try wgt.Box(ui.Widget).init(allocator, .{ .border = null, .direction = .horiz }); │ │721 - errdefer box.deinit(allocator); │ │720 + var scroll = try ui.widget.HeaderScroll.init(allocator, session); │ │721 + errdefer scroll.deinit(allocator); │ │722 + const box = scroll.row(); │ │723 var tab_ids: [2]usize = undefined; │ │724 const view_labels = [_][]const u8{ active_tab_label, removed_tab_label }; │ │725 inline for ([_]ui.RoutablePage.EventsView{ .active, .removed }, view_labels, 0..) |view, view_label, i| {│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │749 button.getFocus().mode = .all; │ │750 button.getFocus().kind = .{ .custom = "submit" }; │ │751 button_id = button.getFocus().id; │ │751 - try box.children.put(allocator, button.getFocus().id, .{ .widget = .{ .text_box = button }, .rect = null, .min_size = null }); │ │752 + try box.children.put(allocator, button.getFocus().id, .{ .widget = .{ .text_box = button }, .rect = null, .min_size = .{ .width = "sync".len + 2, .height = null } });│ │753 } │ │754 │ │755 if (data.header.sync_status) |status_text| { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │758 try box.children.put(allocator, status.getFocus().id, .{ .widget = .{ .text_box = status }, .rect = null, .min_size = null, .flex = .shrink });│ │759 } │ │760 box.getFocus().child_id = tab_ids[@backingInt(data.view)]; │ │760 - return .{ .box = box, .session = session, .tab_ids = tab_ids, .selected_tab = @backingInt(data.view), .button_id = button_id }; │ │761 + return .{ .scroll = scroll, .session = session, .tab_ids = tab_ids, .selected_tab = @backingInt(data.view), .button_id = button_id }; │ │762 } │ │763 │ │764 pub fn deinit(self: *Header.View, allocator: std.mem.Allocator) void { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │764 - self.box.deinit(allocator); │ │765 + self.scroll.deinit(allocator); │ │766 } │ │767 │ │768 pub fn build(self: *Header.View, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) !void {│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────╮ │769 self.clearGrid(); │ │770 if (self.getSelectedIndex()) |index| self.selected_tab = index; │ │771 for (self.tab_ids, 0..) |id, index| { │ │771 - const child = self.box.children.getPtr(id) orelse continue; │ │772 + const child = self.scroll.row().children.getPtr(id) orelse continue;│ │773 const tab = switch (child.widget) { │ │774 .text_box => |*text_box| text_box, │ │775 else => continue, │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │776 }; │ │777 ui.widget.markSelected(tab, index == self.selected_tab); │ │778 } │ │778 - try self.box.build(allocator, constraint, root_focus); │ │779 + try self.scroll.build(allocator, constraint, root_focus); │ │780 } │ │781 │ │782 pub fn input(self: *Header.View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void {│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │782 - const selected = self.box.getFocus().child_id orelse return; │ │783 + const selected = self.scroll.row().getFocus().child_id orelse return; │ │784 const stops = [_]?usize{ self.tab_ids[0], self.tab_ids[1], self.button_id }; │ │785 const count = 2 + @as(usize, @intFromBool(self.button_id != null)); │ │786 const current = std.mem.indexOfScalar(?usize, stops[0..count], selected) orelse return;│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────╮ │799 if (!self.session.is_terminal) return; │ │800 if (self.session.host_request != null) return; │ │801 const button_id = self.button_id orelse return; │ │801 - const child = self.box.children.getPtr(button_id) orelse return; │ │802 + const child = self.scroll.row().children.getPtr(button_id) orelse return;│ │803 const button = switch (child.widget) { │ │804 .text_box => |*button| button, │ │805 else => return, │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────╮ │810 │ │811 fn syncFocused(self: *Header.View) bool { │ │812 const button_id = self.button_id orelse return false; │ │812 - return self.box.getFocus().child_id == button_id; │ │813 + return self.scroll.row().getFocus().child_id == button_id;│ │814 } │ │815 │ │816 pub fn getSelectedIndex(self: *Header.View) ?usize { │ ╰───────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯