╭ changed ────────╮ │src/ui/widget.zig│ ╰─────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 98 inline else => |*case| return case.getFocus(), │ │ 99 } │ │100 } │ │101 + │ │102 + // whether moving up should return to the page header │ │103 + pub fn atTop(self: *Widget, root_focus: *Focus) bool { │ │104 + return switch (self.*) { │ │105 + inline .home_users, .home_repos, .flow_box_scroll, .home_settings, .home_auth, .quit, .repo_files, .repo_commits, .repo_refs, .repo_issues, .repo_patches, .repo_discussions, .repo_events => |*view| view.atTop(),│ │106 + .repo_patch_detail => |*view| view.atTop(root_focus), │ │107 + else => false, │ │108 + }; │ │109 + } │ │110 }; │ │111 │ │112 pub const back_button_width = 3; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────╮ │419 return self.scroll.getFocus(); │ │420 } │ │421 │ │413 - pub fn getSelectedIndex(self: Scroll) ?usize { │ │422 + pub fn atTop(self: Scroll) bool { │ │423 const in = self.scroll.child.flow_box; │ │415 - const child_id = in.focus.child_id orelse return null; │ │416 - return in.indexOfFocusId(child_id); │ │424 + const child_id = in.focus.child_id orelse return false;│ │425 + return in.indexOfFocusId(child_id) == 0; │ │426 } │ │427 │ │428 fn inner(self: *Scroll) *FlowBox { │ ╰────────────────────────────────────────────────────────────────────────╯