╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Undo.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯
632 633 fn focusList(self: *View, root_focus: *Focus) void { 634 root_focus.setFocus(self.listScroll().getFocus().id); 635 } 636 637 fn contentAtTop(self: *View) bool { 638 const scroll = if (self.detailActive()) self.detailScroll() else self.listScroll(); 639 const rows = &scroll.child.box; 640 const id = rows.getFocus().child_id orelse return true; 641 return rows.children.getIndex(id) == 0 and scroll.y == 0; 642 } 643 644 // moving up from the sub header returns to the page's tabs, as does moving 645 // up from the top of the content where there is no sub header 646 pub fn atTop(self: *View) bool { 647 if (self.header() != null) return self.headerActive(); 648 if (self.data.isEmpty(self.session)) return true; 649 // the way back to the list sits above the detail while it shows 650 if (self.detailActive()) if (ui.widget.listBackId(self.detailFrame())) |id| return self.detailFrame().getFocus().child_id == id; 651 return self.contentAtTop(); 652 } 653 654 // arriving from the page's tabs lands on the sub header, not the content 655 pub fn focusHeader(self: *View, root_focus: *Focus) bool { 656 const copyable_text = self.header() orelse return false; 657 root_focus.setFocus(copyable_text.getFocus().id); 658 return true; 659 } 660 pub fn deinit(self: *View, allocator: std.mem.Allocator) void { 661 self.box.deinit(allocator); 662 } 663 pub fn clearGrid(self: *View) void { 664 self.box.clearGrid(); 665 } 666 pub fn getGrid(self: View) ?Grid { 667 return self.box.getGrid(); 668 } 669 pub fn getFocus(self: *View) *Focus { 670 return self.box.getFocus(); 671 } 672 }; 673