╭ changed ──────────────╮ │src/ui/Repo/Patches.zig│ ╰───────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │531 var header = try Header.init(allocator); │ │532 errdefer header.deinit(allocator); │ │533 const aa = session.page_arena.allocator(); │ │534 + const selected_index = View.viewIndex(data.view); │ │535 + const page_selected = std.meta.activeTag(session.data.current_page) == .repo_patches;│ │536 │ │537 // a list tab per status, labeled with its listing's patch count │ │538 for ([_]evt.Patch.Status{ .open, .closed, .merged }, 0..) |status, index| { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │539 const route = ui.RoutablePage.repoPatchesRoute(data.identity, status, data.tag, "") orelse return error.RouteTooLong;│ │538 - const link = try std.fmt.allocPrint(aa, "ai:{s}", .{try route.toUrl(session.page_arena)}); │ │540 + const link = try ui.inPageTabLink(session, route, page_selected and selected_index == index); │ │541 var label_buf: [64]u8 = undefined; │ │542 const label = try std.fmt.bufPrint(&label_buf, "{s} ({d})", .{ @tagName(status), data.window(status).count }); │ │543 try header.addTab(allocator, label, link, index); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │546 // tags tab, labeled with the active tag filter │ │547 { │ │548 const tags_route = ui.RoutablePage.repoThreadTagsRoute(.patch, data.identity, data.tag) orelse return error.RouteTooLong;│ │547 - const tags_link = try std.fmt.allocPrint(aa, "ai:{s}", .{try tags_route.toUrl(session.page_arena)}); │ │549 + const tags_link = try ui.inPageTabLink(session, tags_route, page_selected and selected_index == View.viewIndex(.tags)); │ │550 const label = if (data.tag.len == 0) "tags" else blk: { │ │551 const decoded = std.Uri.percentDecodeInPlace(try aa.dupe(u8, data.tag)); │ │552 break :blk try std.fmt.allocPrint(aa, "tags ({s})", .{decoded}); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │564 .resolve => ui.RoutablePage.repoPatchesResolveRoute(data.identity, data.selected_id, data.theirs_picks) orelse return error.RouteTooLong,│ │565 else => ui.RoutablePage.repoThreadNewRoute(.patch, data.identity) orelse return error.RouteTooLong, │ │566 }; │ │565 - const link = try std.fmt.allocPrint(aa, "ai:{s}", .{try route.toUrl(session.page_arena)}); │ │567 + const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.new)); │ │568 const label: []const u8 = switch (data.view) { │ │569 .edit => "edit", │ │570 .new_comment => "reply", │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │579 // drafts belong to the logged-in user and are not available locally │ │580 if (session.local == null) { │ │581 const route = ui.RoutablePage.repoPatchesDraftsRoute(data.identity) orelse return error.RouteTooLong; │ │580 - const link = try std.fmt.allocPrint(aa, "ai:{s}", .{try route.toUrl(session.page_arena)}); │ │582 + const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.drafts));│ │583 var label_buf: [64]u8 = undefined; │ │584 const label = try std.fmt.bufPrint(&label_buf, "drafts ({d})", .{data.drafts.count}); │ │585 try header.addTab(allocator, label, link, View.viewIndex(.drafts)); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │588 // conflicts tab, labeled with the conflict count │ │589 if (data.conflicts.count > 0) { │ │590 const route = ui.RoutablePage.repoPatchesConflictsRoute(data.identity, "") orelse return error.RouteTooLong; │ │589 - const link = try std.fmt.allocPrint(aa, "ai:{s}", .{try route.toUrl(session.page_arena)}); │ │591 + const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.conflicts));│ │592 var label_buf: [64]u8 = undefined; │ │593 const label = try std.fmt.bufPrint(&label_buf, "conflicts ({d})", .{data.conflicts.count}); │ │594 try header.addTab(allocator, label, link, View.viewIndex(.conflicts)); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯