╭ changed ─────────────╮ │src/ui/Home/Header.zig│ ╰──────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────────╮ │24 } │ │25 │ │26 pub const View = struct { │ │27 - box: wgt.Box(ui.Widget), │ │27 + scroll: wgt.Scroll(ui.Widget), │ │28 data: *const Self, │ │29 tab_ids: std.AutoArrayHashMapUnmanaged(usize, void),│ │30 │ ╰────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────╮ │44 .widget = .{ .title = title_view },│ │45 .rect = null, │ │46 .min_size = null, │ │47 - .shrink = true, │ │47 + .flex = .shrink, │ │48 }); │ │49 } │ │50 │ ╰───────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────╮ │107 .widget = .{ .spacer = spacer },│ │108 .rect = null, │ │109 .min_size = null, │ │110 + .flex = .grow, │ │111 }); │ │112 } │ │113 │ ╰─────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │154 }); │ │155 } │ │156 │ │156 - var self = View{ .box = box, .data = data, .tab_ids = tab_ids }; │ │157 + var self = View{ │ │158 + .scroll = try wgt.Scroll(ui.Widget).init(allocator, .{ .box = box }, .{ .direction = .horiz, .show_bar = false, .web_native = !session.is_terminal }),│ │159 + .data = data, │ │160 + .tab_ids = tab_ids, │ │161 + }; │ │162 self.getFocus().child_id = selected_tab orelse self.tab_ids.keys()[0]; │ │163 return self; │ │164 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────╮ │165 │ │166 pub fn deinit(self: *View, allocator: std.mem.Allocator) void {│ │162 - self.box.deinit(allocator); │ │167 + self.scroll.deinit(allocator); │ │168 self.tab_ids.deinit(allocator); │ │169 } │ │170 │ ╰────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │171 pub fn build(self: *View, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) !void {│ │172 self.clearGrid(); │ │168 - for (self.box.children.keys(), self.box.children.values()) |id, *child| { │ │173 + const box = &self.scroll.child.box; │ │174 + for (box.children.keys(), box.children.values()) |id, *child| { │ │175 const tb: ?*wgt.TextBox(ui.Widget) = switch (child.widget) { │ │176 .text_box => |*x| x, │ │177 .auth_tab => |*at| blk: { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │185 t.options.border_style = if (self.getFocus().child_id == id) .single else .hidden; │ │186 } │ │187 } │ │182 - try self.box.build(allocator, constraint, root_focus); │ │188 + var scroll_constraint = constraint; │ │189 + scroll_constraint.min_size.width = constraint.max_size.width orelse constraint.min_size.width;│ │190 + try self.scroll.build(allocator, scroll_constraint, root_focus); │ │191 } │ │192 │ │193 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────╮ │194 _ = allocator; │ │195 const current_tab = self.currentTabIndex() orelse return; │ │196 if (inp.moveTab(key, current_tab, self.tab_ids.count())) |new_tab| { │ │189 - root_focus.setFocus(self.tab_ids.keys()[new_tab]); │ │197 + const tab_id = self.tab_ids.keys()[new_tab]; │ │198 + root_focus.setFocus(tab_id); │ │199 + const tab = self.scroll.child.box.children.get(tab_id) orelse return;│ │200 + if (tab.rect) |rect| self.scroll.scrollToRect(rect); │ │201 } │ │202 } │ │203 │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────╮ │204 pub fn clearGrid(self: *View) void {│ │194 - self.box.clearGrid(); │ │205 + self.scroll.clearGrid(); │ │206 } │ │207 │ │208 pub fn getGrid(self: View) ?Grid { │ ╰─────────────────────────────────────────────╯ ╭──────────────────────────────────────────────╮ │198 - return self.box.getGrid(); │ │209 + return self.scroll.getGrid(); │ │210 } │ │211 │ │212 pub fn getFocus(self: *View) *Focus {│ ╰──────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯