╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ─────────────╮ │src/ui/Fork/Header.zig│ ╰──────────────────────╯ ╭────────────────────────────────────────────────────────╮ │169 .tab_ids = tab_ids, │ │170 .tabs_id = tabs_id, │ │171 .first_group_width = first_group_width,│ │172 + .session = session, │ │173 }; │ │174 } │ │175 │ ╰────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │181 pub fn build(self: *View, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) !void {│ │182 self.clearGrid(); │ │183 const box = &self.scroll.child.box; │ │184 + const back_visible = self.session.back == .available; │ │185 + ui.widget.setBackButtonVisible(box, back_visible); │ │186 const tabs_child = self.tabsChild(); │ │187 const tabs_box = &tabs_child.widget.box; │ │188 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │203 │ │204 const viewport_width = constraint.max_size.width orelse constraint.min_size.width; │ │205 const content_width = if (viewport_width) |width| width -| 2 else null; │ │200 - const wrap = if (content_width) |width| self.first_group_width + tabs_width > width else false; │ │206 + const back_width: usize = if (back_visible) ui.widget.back_button_width else 0; │ │207 + const wrap = if (content_width) |width| self.first_group_width + back_width + tabs_width > width else false;│ │208 box.options.direction = if (wrap) .vert else .horiz; │ │209 tabs_child.min_size = if (wrap) .{ .width = content_width, .height = null } else null; │ │210 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─────────────╮ │src/ui/Home/Header.zig│ ╰──────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │24 pub const View = struct { │ │25 scroll: wgt.Scroll(ui.Widget), │ │26 tab_ids: std.AutoArrayHashMapUnmanaged(usize, void), │ │27 + session: *ui.Session, │ │28 │ │29 pub fn init(allocator: std.mem.Allocator, data: *const Self, session: *ui.Session) !View { │ │30 var box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = .hidden, .rounded_corners = true, .direction = .horiz });│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │32 │ │33 var tab_ids: std.AutoArrayHashMapUnmanaged(usize, void) = .empty; │ │34 errdefer tab_ids.deinit(allocator); │ │35 + │ │36 + try ui.widget.addBackButton(allocator, &box, session); │ │37 │ │38 + { │ │39 + var text = try wgt.Text.init(allocator, " "); │ │40 + errdefer text.deinit(allocator); │ │41 + try box.children.put(allocator, text.getFocus().id, .{ │ │42 + .widget = .{ .text = text }, │ │43 + .rect = null, │ │44 + .min_size = .{ .width = 1, .height = null }, │ │45 + }); │ │46 + } │ │47 + │ │48 // title sits to the left of the tabs │ │49 { │ │50 var title_view = try ui.Title.View.init(allocator, &data.title);│ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │173 var self = View{ │ │174 .scroll = try wgt.Scroll(ui.Widget).init(allocator, .{ .box = box }, .{ .direction = .horiz, .show_bar = false, .web_native = !session.is_terminal }),│ │175 .tab_ids = tab_ids, │ │176 + .session = session, │ │177 }; │ │178 self.getFocus().child_id = selected_tab orelse self.tab_ids.keys()[0]; │ │179 return self; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │187 pub fn build(self: *View, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) !void {│ │188 self.clearGrid(); │ │189 const box = &self.scroll.child.box; │ │190 + ui.widget.setBackButtonVisible(box, self.session.back == .available); │ │191 for (box.children.keys(), box.children.values()) |id, *child| { │ │192 const tb: ?*wgt.TextBox = switch (child.widget) { │ │193 .text_box => |*x| x, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─────────────╮ │src/ui/Repo/Header.zig│ ╰──────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │48 tab_ids: std.AutoArrayHashMapUnmanaged(usize, void), │ │49 tabs_id: usize, │ │50 first_group_width: usize, │ │51 + session: *ui.Session, │ │52 │ │53 pub fn init(allocator: std.mem.Allocator, data: *const Self, commit_count: ?u64, session: *ui.Session) !View { │ │54 var box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = .hidden, .rounded_corners = true, .direction = .horiz });│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────╮ │73 const commits_label_width = try xitui.width.displayWidth(commits_label);│ │74 var first_group_width = try data.title.width(); │ │75 │ │76 + try ui.widget.addBackButton(allocator, &title_box, session); │ │77 + │ │78 // the user's name (local mode has no user pages to link to) │ │79 if (!session.data.is_local) { │ │80 var text_buf: [evt.User.name_max_len + 1]u8 = undefined; │ ╰────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────╮ │343 .tab_ids = tab_ids, │ │344 .tabs_id = tabs_id, │ │345 .first_group_width = first_group_width,│ │346 + .session = session, │ │347 }; │ │348 } │ │349 │ ╰────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯