╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Patches.zig│ ╰───────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1012 { │ │1013 const labels_route = try thread.searchRoute(ui.RoutablePage.repoThreadLabelsRoute(.patch, data.identity), data.search); │ │1014 const labels_link = try ui.inPageTabLink(session, labels_route, page_selected and selected_index == View.viewIndex(.labels));│ │1017 - try header.addTab(allocator, labels_tab_label, labels_link, View.viewIndex(.labels)); │ │1015 + try header.addTab(allocator, labels_tab_label, "", labels_link, View.viewIndex(.labels)); │ │1016 } │ │1017 │ │1018 // new-patch tab; an edit or resolve url shows its tab in this place │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │1038 .resolve => resolve_tab_label, │ │1039 else => new_tab_label, │ │1040 }; │ │1043 - try header.addTab(allocator, label, link, View.viewIndex(.new)); │ │1041 + try header.addTab(allocator, label, "", link, View.viewIndex(.new));│ │1042 } │ │1043 │ │1044 // drafts belong to the logged-in user and are not available locally │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1045 if (session.data.host_kind != .local) { │ │1046 const route = ui.RoutablePage.repoPatchesDraftsRoute(data.identity) orelse return error.RouteTooLong; │ │1047 const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.drafts)); │ │1050 - var label_buf: [64]u8 = undefined; │ │1051 - const label = try std.fmt.bufPrint(&label_buf, drafts_tab_label ++ " ({d})", .{data.drafts.count}); │ │1052 - try header.addTab(allocator, label, link, View.viewIndex(.drafts)); │ │1048 + try header.addTab(allocator, drafts_tab_label, try session.page_arena.allocator().print("({d})", .{data.drafts.count}), link, View.viewIndex(.drafts));│ │1049 } │ │1050 │ │1051 // conflicts tab, labeled with the conflict count │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1052 if (data.conflicts.count > 0) { │ │1053 const route = ui.RoutablePage.repoPatchesConflictsRoute(data.identity, "") orelse return error.RouteTooLong; │ │1054 const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.conflicts)); │ │1059 - var label_buf: [64]u8 = undefined; │ │1060 - const label = try std.fmt.bufPrint(&label_buf, conflicts_tab_label ++ " ({d})", .{data.conflicts.count}); │ │1061 - try header.addTab(allocator, label, link, View.viewIndex(.conflicts)); │ │1055 + try header.addTab(allocator, conflicts_tab_label, try session.page_arena.allocator().print("({d})", .{data.conflicts.count}), link, View.viewIndex(.conflicts));│ │1056 } │ │1057 │ │1058 header.select(View.viewIndex(data.view)); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───────────────╮ │src/ui/widget/thread.zig│ ╰────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │482 return route.withSearch(query) orelse error.RouteTooLong; │ │483 } │ │484 │ │485 -// a status tab's label: its listing's count, marked when a search capped it │ │486 -pub fn countLabel(buffer: []u8, name: []const u8, win: anytype) ![]const u8 { │ │487 - return std.fmt.bufPrint(buffer, "{s} ({d}{s})", .{ name, win.count, if (win.more) "+" else "" }); │ │485 +// a status tab's bottom label: its listing's count, marked when a search capped it │ │486 +pub fn countLabel(session: *ui.Session, win: anytype) ![]const u8 { │ │487 + return session.page_arena.allocator().print("({d}{s})", .{ win.count, if (win.more) "+" else "" });│ │488 } │ │489 │ │490 // the common sub-header used by each thread page: the search box, then the │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │514 return .{ .box = box, .tab_ids = .empty }; │ │515 } │ │516 │ │517 - pub fn addTab(self: *Header, allocator: std.mem.Allocator, label: []const u8, link: []const u8, view_index: usize) !void { │ │518 - var text_box = try wgt.TextBox.init(allocator, label, .{ .border = .single, .round_corners = true, .wrap_kind = .none }); │ │517 + pub fn addTab(self: *Header, allocator: std.mem.Allocator, label: []const u8, bottom_label: []const u8, link: []const u8, view_index: usize) !void { │ │518 + var text_box = try wgt.TextBox.init(allocator, label, .{ .border = .single, .round_corners = true, .wrap_kind = .none, .bottom_label = .{ .text = bottom_label } });│ │519 errdefer text_box.deinit(allocator); │ │520 text_box.getFocus().mode = .all; │ │521 text_box.getFocus().kind = .{ .custom = link }; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │523 try self.box.children.put(allocator, text_box.getFocus().id, .{ │ │524 .widget = .{ .text_box = text_box }, │ │525 .rect = null, │ │526 - .min_size = .{ .width = label.len + 2, .height = null }, │ │526 + .min_size = .{ .width = @max(label.len, bottom_label.len) + 2, .height = null },│ │527 }); │ │528 } │ │529 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯