╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Commits.zig ──────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
669 // any further; otherwise up-arrow stays in the pane (scrolling or moving 670 // between hunks). when the list holds focus, report its selection directly. 671 pub fn getSelectedIndex(self: *View) ?usize { 672 if (self.diffActive()) { 673 const inner = self.diffInner(); 674 const cid = inner.getFocus().child_id orelse return 1; 675 const first_focused = inner.children.count() > 0 and cid == inner.children.keys()[0]; 676 return if (first_focused and self.diffScroll().y == 0) 0 else 1; 677 } 678 const lb = self.listBox(); 679 const cid = lb.getFocus().child_id orelse return null; 680 return lb.children.getIndex(cid); 681 } 682 }; 683 684 // the "a:" navigation link for the commits page starting at `start_oid` within 685 // `identity`, showing the selected commit's first `after` hunks (0 = default). 686 fn commitsLink(page_arena: *std.heap.ArenaAllocator, identity: []const u8, start_oid: []const u8, after: usize) ![]const u8 { 687 const route = ui.RoutablePage.repoCommitsRoute(identity, start_oid, after) orelse return error.RouteTooLong; 688 const url = try route.urlAlloc(page_arena); 689 return std.fmt.allocPrint(page_arena.allocator(), "a:{s}", .{url}); 690 } 691