╭ changed ─────────────╮ │src/ui/Home/Header.zig│ ╰──────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │28 pub const View = struct { │ │29 scroll: wgt.Scroll(ui.Widget), │ │30 tab_ids: std.AutoArrayHashMapUnmanaged(usize, void), │ │31 + tabs_id: usize, │ │32 + gap_id: usize, │ │33 + first_group_width: usize, │ │34 session: *ui.Session, │ │35 │ │36 pub fn init(allocator: std.mem.Allocator, data: *const Self, session: *ui.Session) !View {│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │37 var box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = .hidden, .rounded_corners = true, .direction = .horiz });│ │38 errdefer box.deinit(allocator); │ │39 │ │40 + var title_box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .horiz }); │ │41 + var title_box_owned = false; │ │42 + errdefer if (!title_box_owned) title_box.deinit(allocator); │ │43 + │ │44 + var tabs_box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .horiz }); │ │45 + var tabs_box_owned = false; │ │46 + errdefer if (!tabs_box_owned) tabs_box.deinit(allocator); │ │47 + │ │48 var tab_ids: std.AutoArrayHashMapUnmanaged(usize, void) = .empty; │ │49 errdefer tab_ids.deinit(allocator); │ │50 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────╮ │40 - try ui.widget.addBackButton(allocator, &box, session); │ │51 + // the leading space plus the title │ │52 + const first_group_width = 1 + try data.title.width(); │ │53 + │ │54 + try ui.widget.addBackButton(allocator, &title_box, session);│ │55 │ │56 { │ │57 var text = try wgt.Text.init(allocator, " "); │ ╰────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────╮ │58 errdefer text.deinit(allocator); │ │45 - try box.children.put(allocator, text.getFocus().id, .{ │ │59 + try title_box.children.put(allocator, text.getFocus().id, .{│ │60 .widget = .{ .text = text }, │ │61 .rect = null, │ │62 .min_size = .{ .width = 1, .height = null }, │ ╰────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │67 { │ │68 var title_view = try ui.Title.View.init(allocator, &data.title); │ │69 errdefer title_view.deinit(allocator); │ │56 - // shrink the title when there is not enough space │ │57 - try box.children.put(allocator, title_view.getFocus().id, .{ │ │70 + try title_box.children.put(allocator, title_view.getFocus().id, .{│ │71 .widget = .{ .title = title_view }, │ │72 .rect = null, │ │73 .min_size = null, │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────╮ │61 - .flex = .shrink,│ │74 }); │ │75 } │ │76 │ ╰────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────╮ │78 { │ │79 var text = try wgt.Text.init(allocator, " "); │ │80 errdefer text.deinit(allocator); │ │69 - try box.children.put(allocator, text.getFocus().id, .{ │ │81 + try tabs_box.children.put(allocator, text.getFocus().id, .{│ │82 .widget = .{ .text = text }, │ │83 .rect = null, │ │84 .min_size = .{ .width = 1, .height = null }, │ ╰───────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │108 text_box.getFocus().kind = .{ .custom = repos_link }; │ │109 try tab_ids.put(allocator, text_box.getFocus().id, {}); │ │110 if (std.mem.eql(u8, repos_link, current_link)) selected_tab = text_box.getFocus().id;│ │ 99 - try box.children.put(allocator, text_box.getFocus().id, .{ │ │111 + try tabs_box.children.put(allocator, text_box.getFocus().id, .{ │ │112 .widget = .{ .text_box = text_box }, │ │113 .rect = null, │ │114 .min_size = .{ .width = repos_tab_label.len + 2, .height = null }, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │123 text_box.getFocus().kind = .{ .custom = users_link }; │ │124 try tab_ids.put(allocator, text_box.getFocus().id, {}); │ │125 if (std.mem.eql(u8, users_link, current_link)) selected_tab = text_box.getFocus().id;│ │114 - try box.children.put(allocator, text_box.getFocus().id, .{ │ │126 + try tabs_box.children.put(allocator, text_box.getFocus().id, .{ │ │127 .widget = .{ .text_box = text_box }, │ │128 .rect = null, │ │129 .min_size = .{ .width = users_tab_label.len + 2, .height = null }, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────╮ │134 { │ │135 var spacer = try ui.widget.Spacer.init(allocator); │ │136 errdefer spacer.deinit(allocator); │ │125 - try box.children.put(allocator, spacer.getFocus().id, .{ │ │137 + try tabs_box.children.put(allocator, spacer.getFocus().id, .{│ │138 .widget = .{ .spacer = spacer }, │ │139 .rect = null, │ │140 .min_size = null, │ ╰──────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯