╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Commits.zig│ ╰───────────────────────╯ ╭────────────────────────────────────────────────────╮ │182 var hunk = hunk_val; │ │183 defer hunk.deinit(gpa); │ │184 │ │187 - if (hunks_seen < skip_hunks) { │ │188 - hunks_seen += 1; │ │189 - continue; │ │190 - } │ │191 - if (total_lines >= budget) { │ │185 + if (hunks.items.len >= max_hunks) {│ │186 has_more = true; │ │187 break :file_loop; │ │188 } │ ╰────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────╮ │194 file_header_emitted = true; │ │195 } │ │196 try appendHunkLines(arena, &lines, &hunk_iter, &hunk); │ │203 - total_lines += lines.items.len; │ │197 try hunks.append(arena, .{ .lines = try lines.toOwnedSlice(arena) });│ │205 - hunks_seen += 1; │ │198 } │ │199 } │ │200 │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │209 - return .{ .hunks = try hunks.toOwnedSlice(arena), .shown_hunks = hunks_seen, .has_more = has_more };│ │201 + const shown = hunks.items.len; │ │202 + return .{ .hunks = try hunks.toOwnedSlice(arena), .shown_hunks = shown, .has_more = has_more }; │ │203 } │ │204 │ │205 // append a hunk's header and its edit lines │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │259 session: *ui.Session, │ │260 // the commit whose diff the pane currently shows (index into data.commits).│ │261 diffed_index: ?usize, │ │269 - // mutable diff state for the displayed commit (seeded from data, grown by │ │270 - // "load more"). │ │271 - shown_hunks: usize, │ │272 - has_more: bool, │ │273 - // focus id of the "load more" row, when present. │ │274 - load_more_id: ?usize, │ │262 │ │263 const list_index: usize = 0; │ │264 const diff_index: usize = 1; │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │280 try addRow(allocator, &list_box, commit.message, ""); │ │281 } │ │282 if (data.next_start) |next| { │ │296 - try addRow(allocator, &list_box, "next", try commitsPageLink(session.page_arena, data.identity, next));│ │283 + try addRow(allocator, &list_box, "next", try commitsLink(session.page_arena, data.identity, next, 0)); │ │284 } │ │285 if (list_box.children.count() > 0) list_box.getFocus().child_id = list_box.children.keys()[0]; │ │286 break :blk try wgt.Scroll(ui.Widget).init(allocator, .{ .box = list_box }, .{ .direction = .vert }); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────╮ │314 .data = data, │ │315 .session = session, │ │316 .diffed_index = null,│ │330 - .shown_hunks = 0, │ │331 - .has_more = false, │ │332 - .load_more_id = null,│ │317 }; │ │318 } │ │319 │ ╰──────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │338 try box.children.put(allocator, tb.getFocus().id, .{ .widget = .{ .text_box = tb }, .rect = null, .min_size = null }); │ │339 } │ │340 │ │357 - // the focusable "load more" row; its kind carries the GET endpoint the web │ │358 - // client fetches (the TUI reopens the repo instead). │ │359 - fn addLoadMore(self: *View, allocator: std.mem.Allocator, box: *wgt.Box(ui.Widget), oid: []const u8, after_hunks: usize) !void { │ │360 - const link = try std.fmt.allocPrint(self.session.page_arena.allocator(), "fetch:/_diff/{s}/{s}?after={d}", .{ self.data.identity, oid, after_hunks });│ │341 + // the focusable "load more" row. it's a navigation link to this commit's │ │342 + // route with a larger `after`, so activating it (the host follows the "a:" │ │343 + // link) reloads the page showing more hunks — the same on the TUI and web. │ │344 + fn addLoadMore(self: *View, allocator: std.mem.Allocator, box: *wgt.Box(ui.Widget), oid: []const u8, next_after: usize) !void { │ │345 + const link = try commitsLink(self.session.page_arena, self.data.identity, oid, next_after); │ │346 var tb = try wgt.TextBox(ui.Widget).init(allocator, "load more", .{ .border_style = .hidden, .rounded_corners = true, .wrap_kind = .none }); │ │347 errdefer tb.deinit(allocator); │ │348 tb.getFocus().focusable = true; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │349 tb.getFocus().kind = .{ .custom = link }; │ │350 try box.children.put(allocator, tb.getFocus().id, .{ .widget = .{ .text_box = tb }, .rect = null, .min_size = null });│ │366 - self.load_more_id = tb.getFocus().id; │ │351 } │ │352 │ │353 pub fn deinit(self: *View, allocator: std.mem.Allocator) void { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │400 if (root_focus.grandchild_id) |g| { │ │401 if (self.box.getFocus().children.contains(g)) { │ │402 if (self.selectedCommitIndex()) |sel| { │ │419 - if (ui.RoutablePage.repoCommitsRoute(self.data.identity, self.data.commits[sel].oid)) |route| │ │403 + // selection moves reset the diff expansion (after = 0). │ │404 + if (ui.RoutablePage.repoCommitsRoute(self.data.identity, self.data.commits[sel].oid, 0)) |route|│ │405 self.session.data.current_page = route; │ │406 } │ │407 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │470 for (inner.children.values()) |*child| child.widget.deinit(allocator); │ │471 inner.children.clearAndFree(allocator); │ │472 inner.getFocus().child_id = null; │ │488 - self.load_more_id = null; │ │473 │ │474 for (commit.hunks) |hunk| try self.addHunkBox(allocator, inner, hunk.lines); │ │491 - if (commit.has_more) try self.addLoadMore(allocator, inner, commit.oid, commit.shown_hunks); │ │492 - self.shown_hunks = commit.shown_hunks; │ │493 - self.has_more = commit.has_more; │ │475 + // the load-more link reloads showing one more page of this commit's hunks. │ │476 + if (commit.has_more) try self.addLoadMore(allocator, inner, commit.oid, commit.shown_hunks + diff_page);│ │477 │ │478 const sc = self.diffScroll(); │ │479 sc.x = 0; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯