╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ─────────────╮ │src/ui/User/Header.zig│ ╰──────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │30 pub const View = struct { │ │31 scroll: wgt.Scroll(ui.Widget), │ │32 tab_ids: std.AutoArrayHashMapUnmanaged(usize, void), │ │33 + tabs_id: usize, │ │34 + gap_id: usize, │ │35 + first_group_width: usize, │ │36 session: *ui.Session, │ │37 │ │38 pub fn init(allocator: std.mem.Allocator, data: *const Self, session: *ui.Session) !View {│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │39 var box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = .hidden, .rounded_corners = true, .direction = .horiz });│ │40 errdefer box.deinit(allocator); │ │41 │ │42 + var title_box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .horiz }); │ │43 + var title_box_owned = false; │ │44 + errdefer if (!title_box_owned) title_box.deinit(allocator); │ │45 + │ │46 + var tabs_box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .horiz }); │ │47 + var tabs_box_owned = false; │ │48 + errdefer if (!tabs_box_owned) tabs_box.deinit(allocator); │ │49 + │ │50 var tab_ids: std.AutoArrayHashMapUnmanaged(usize, void) = .empty; │ │51 errdefer tab_ids.deinit(allocator); │ │52 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────╮ │42 - try ui.widget.addBackButton(allocator, &box, session); │ │53 + // the leading space plus the title │ │54 + const first_group_width = 1 + try data.title.width(); │ │55 + │ │56 + try ui.widget.addBackButton(allocator, &title_box, session);│ │57 │ │58 { │ │59 var text = try wgt.Text.init(allocator, " "); │ ╰────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────╮ │60 errdefer text.deinit(allocator); │ │47 - try box.children.put(allocator, text.getFocus().id, .{ │ │61 + try title_box.children.put(allocator, text.getFocus().id, .{│ │62 .widget = .{ .text = text }, │ │63 .rect = null, │ │64 .min_size = .{ .width = 1, .height = null }, │ ╰────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │71 errdefer title_view.deinit(allocator); │ │72 title_view.getFocus().mode = .all; │ │73 title_view.getFocus().kind = .{ .custom = "a:/" }; │ │60 - // shrink the title when there is not enough space │ │61 - try box.children.put(allocator, title_view.getFocus().id, .{ │ │74 + try title_box.children.put(allocator, title_view.getFocus().id, .{│ │75 .widget = .{ .title = title_view }, │ │76 .rect = null, │ │77 .min_size = null, │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────╮ │65 - .flex = .shrink,│ │78 }); │ │79 } │ │80 │ ╰────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────╮ │82 { │ │83 var text = try wgt.Text.init(allocator, " "); │ │84 errdefer text.deinit(allocator); │ │73 - try box.children.put(allocator, text.getFocus().id, .{ │ │85 + try tabs_box.children.put(allocator, text.getFocus().id, .{│ │86 .widget = .{ .text = text }, │ │87 .rect = null, │ │88 .min_size = .{ .width = 1, .height = null }, │ ╰───────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────╮ │123 text_box.getFocus().kind = .{ .custom = repos_link }; │ │124 try tab_ids.put(allocator, text_box.getFocus().id, {}); │ │125 if (std.mem.eql(u8, repos_link, selected_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 = repos_tab_label.len + 2, .height = null }, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────╮ │138 text_box.getFocus().kind = .{ .custom = forks_link }; │ │139 try tab_ids.put(allocator, text_box.getFocus().id, {}); │ │140 if (std.mem.eql(u8, forks_link, selected_link)) selected_tab = text_box.getFocus().id;│ │129 - try box.children.put(allocator, text_box.getFocus().id, .{ │ │141 + try tabs_box.children.put(allocator, text_box.getFocus().id, .{ │ │142 .widget = .{ .text_box = text_box }, │ │143 .rect = null, │ │144 .min_size = .{ .width = forks_tab_label.len + 2, .height = null }, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────╮ │149 { │ │150 var spacer = try ui.widget.Spacer.init(allocator); │ │151 errdefer spacer.deinit(allocator); │ │140 - try box.children.put(allocator, spacer.getFocus().id, .{ │ │152 + try tabs_box.children.put(allocator, spacer.getFocus().id, .{│ │153 .widget = .{ .spacer = spacer }, │ │154 .rect = null, │ │155 .min_size = null, │ ╰──────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯