╭ changed ──────────────╮ │src/ui/Repo/Commits.zig│ ╰───────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │442 var list_scroll = blk: { │ │443 var list_box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .vert, .stretch = true });│ │444 errdefer list_box.deinit(allocator); │ │445 - for (data.commits) |commit| { │ │445 + for (data.commits, 0..) |commit, index| { │ │446 // an in-page "ai:" anchor so a commit row is clickable with │ │447 // js off (the browser follows it, rooting the list there); │ │448 // with wasm the click just selects it and swaps the diff pane. │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │449 - try addRow(allocator, &list_box, firstLine(commit.message), try commitRowLink(session.page_arena, data.identity, commit.oid, "")); │ │449 + const content = if (index == 0) data.content else Content{ .diff = .{} }; │ │450 + try addRow(allocator, &list_box, firstLine(commit.message), try commitRowLink(session.page_arena, data.identity, commit, content));│ │451 } │ │452 if (data.next_start) |next| { │ │453 try addRow(allocator, &list_box, "next →", try commitsLink(session.page_arena, data.identity, next, 0, "")); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │631 │ │632 // swap the diff pane to the selected commit when it changes. │ │633 try self.refreshDiff(allocator); │ │633 - │ │634 - // mirror the focused commit into the url so it updates as the selection │ │635 - // moves, but only while focus is inside this view (the list or diff). when │ │636 - // focus sits on the header tab, use the page's base /commits route. │ │637 - if (root_focus.grandchild_id) |g| { │ │638 - if (self.box.getFocus().children.contains(g)) { │ │639 - if (self.selectedCommitIndex()) |sel| { │ │640 - const oid = self.data.commits[sel].oid; │ │641 - const window_start = self.data.commits[sel].window_start; │ │642 - // mirror the commit's current diff window so the url stays │ │643 - // linkable (0 for any commit but the windowed start one). │ │644 - // selecting another commit leaves the message behind, like │ │645 - // it leaves the path filter behind. │ │646 - const mirrored = switch (self.paneContent(sel)) { │ │647 - .message => ui.RoutablePage.repoCommitMessageRoute(self.data.identity, .object, oid), │ │648 - .diff => |d| ui.RoutablePage.repoCommitsRoute(self.data.identity, .object, oid, window_start, d.path),│ │649 - }; │ │650 - if (mirrored) |route| self.session.data.current_page = route; │ │651 - } │ │652 - } │ │653 - } │ │634 │ │635 // the selected list row shows a border (the focused TextBox upgrades it │ │636 // to a double border itself); the rest stay borderless. │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │969 return std.fmt.allocPrint(page_arena.allocator(), "a:{s}", .{url}); │ │970 } │ │971 │ │992 -// the in-page "ai:" anchor for selecting `oid` in `identity`'s commit list. it │ │993 -// points at the same route as commitsLink but the "ai:" prefix keeps wasm clicks │ │994 -// in-page (crossPageLink ignores it); the href is only followed with js off. │ │995 -fn commitRowLink(page_arena: *std.heap.ArenaAllocator, identity: []const u8, oid: []const u8, path: []const u8) ![]const u8 {│ │996 - const route = ui.RoutablePage.repoCommitsRoute(identity, .object, oid, 0, path) orelse return error.RouteTooLong; │ │972 +// the in-page "ai:" anchor for selecting a commit with its current pane content │ │973 +// and window. the href is only followed with js off. │ │974 +fn commitRowLink(page_arena: *std.heap.ArenaAllocator, identity: []const u8, commit: Commit, content: Content) ![]const u8 { │ │975 + const route = (switch (content) { │ │976 + .message => ui.RoutablePage.repoCommitMessageRoute(identity, .object, commit.oid), │ │977 + .diff => |diff| ui.RoutablePage.repoCommitsRoute(identity, .object, commit.oid, commit.window_start, diff.path), │ │978 + }) orelse return error.RouteTooLong; │ │979 const url = try route.toUrl(page_arena); │ │980 return std.fmt.allocPrint(page_arena.allocator(), "ai:{s}", .{url}); │ │981 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯