╭ changed ──────────────╮ │src/ui/Repo/Commits.zig│ ╰───────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────────────╮ │45 next_start: ?[]const u8, │ │46 // what the pane shows for the commit the log walks from.│ │47 content: Content = .{ .diff = .{} }, │ │48 -// the ref banner shown above the log. │ │49 -header: Header, │ │48 │ │49 const Self = @This(); │ │50 │ ╰─────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │167 .commits = try aa.dupe(Commit, buf[0..count]), │ │168 .next_start = next_start, │ │169 .content = try pageContent(aa, content), │ │172 - .header = try Header.init(aa, resolved.ref_or_oid, resolved.value),│ │170 }; │ │171 } │ │172 │ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────╮ │181 .commits = &.{}, │ │182 .next_start = null, │ │183 .content = try pageContent(aa, content), │ │187 - .header = try Header.init(aa, ref_or_oid, value),│ │184 }; │ │185 } │ │186 │ ╰──────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │292 } │ │293 │ │294 pub const View = struct { │ │299 - // a vertical stack: the ref banner on top, then a horizontal │ │295 + // a vertical stack: the clone url row on top, then a horizontal │ │296 // split with the commit list on the left and a diff pane on the right │ │297 // showing the selected commit's diff. │ │302 - box: wgt.Box(ui.Widget), // vert: [header_index] = banner, [content_index] = split │ │298 + box: wgt.Box(ui.Widget), // vert: [header_index] = clone url row, [content_index] = split│ │299 data: *const Self, │ │300 session: *ui.Session, │ │301 // the commit whose diff the pane currently shows (index into data.commits). │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │313 var outer = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .vert }); │ │314 errdefer outer.deinit(allocator); │ │315 │ │320 - // the ref banner at the top. │ │316 + // the clone url at the top. │ │317 { │ │322 - var header_view = try Header.View.init(allocator, &data.header, session, data.location); │ │318 + var header_view = try Header.View.init(allocator, session, data.location); │ │319 errdefer header_view.deinit(allocator); │ │320 try outer.children.put(allocator, header_view.getFocus().id, .{ .widget = .{ .repo_commits_header = header_view }, .rect = null, .min_size = .{ .width = null, .height = 3 } });│ │321 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │728 return std.fmt.allocPrint(page_arena.allocator(), "a:{s}", .{url}); │ │729 } │ │730 │ │735 -// the "<ref_or_oid> <value>" banner shown above the log. │ │731 +// the clone url shown above the log. │ │732 pub const Header = struct { │ │737 - content: []const u8, │ │738 - │ │739 - // `value` arrives url-encoded, so decode it for display. │ │740 - pub fn init(aa: std.mem.Allocator, ref_or_oid: ui.RoutablePage.RefOrOid, value: []const u8) !Header { │ │741 - const decoded = std.Uri.percentDecodeInPlace(try aa.dupe(u8, value)); │ │742 - return .{ │ │743 - .content = try std.fmt.allocPrint(aa, "{s} {s}", .{ @tagName(ref_or_oid), decoded }), │ │744 - }; │ │745 - } │ │746 - │ │733 pub const View = struct { │ │734 box: wgt.Box(ui.Widget), │ │749 - data: *const Header, │ │735 │ │751 - pub fn init(allocator: std.mem.Allocator, data: *const Header, session: *ui.Session, location: ui.RoutablePage.RepoLocation) !Header.View {│ │736 + pub fn init(allocator: std.mem.Allocator, session: *ui.Session, location: ui.RoutablePage.RepoLocation) !Header.View { │ │737 var box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .horiz }); │ │738 errdefer box.deinit(allocator); │ │739 + │ │740 + // the spacer pushes the clone url to the right edge. │ │741 + { │ │742 + var spacer = try ui.widget.Spacer.init(allocator); │ │743 + errdefer spacer.deinit(allocator); │ │744 + try box.children.put(allocator, spacer.getFocus().id, .{ .widget = .{ .spacer = spacer }, .rect = null, .min_size = null }); │ │745 + } │ │746 │ │747 if (session.data.host_kind == .server) { │ │748 if (try ui.widget.CopyableText.initClone(allocator, session, location)) |value| { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │753 try box.children.put(allocator, clone_url.getFocus().id, .{ .widget = .{ .copyable_text = clone_url }, .rect = null, .min_size = .{ .width = min_width, .height = 3 }, .max_size = .{ .width = min_width, .height = 3 } });│ │754 } │ │755 } │ │764 - │ │765 - var spacer = try ui.widget.Spacer.init(allocator); │ │766 - errdefer spacer.deinit(allocator); │ │767 - try box.children.put(allocator, spacer.getFocus().id, .{ .widget = .{ .spacer = spacer }, .rect = null, .min_size = null }); │ │756 │ │769 - var text_box = try wgt.TextBox.init(allocator, data.content, .{ .border_style = .hidden, .wrap_kind = .none }); │ │770 - errdefer text_box.deinit(allocator); │ │771 - try box.children.put(allocator, text_box.getFocus().id, .{ .widget = .{ .text_box = text_box }, .rect = null, .min_size = null, .flex = .shrink }); │ │772 - │ │773 - return .{ .box = box, .data = data }; │ │757 + return .{ .box = box }; │ │758 } │ │759 │ │760 pub fn deinit(self: *Header.View, allocator: std.mem.Allocator) void { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯