╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Undo.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
621 } 622 } else if (inp.rowDelta(key, @intCast(self.listScroll().child.box.children.count()))) |delta| { 623 ui.widget.moveRowFocus(&self.listScroll().child.box, self.listScroll(), root_focus, delta); 624 } else switch (key) { 625 .arrow_right, .enter => if (self.selected() != null) { 626 root_focus.setFocus(self.detailScroll().getFocus().id); 627 }, 628 else => {}, 629 } 630 } 631 632 // the confirm button submits the form the web renderer posts 633 fn clearInput(self: *View, key: Key, root_focus: *Focus) !void { 634 const center = &self.box.children.values()[content_index].widget.center; 635 const button_id = center.child.box.getFocus().child_id orelse return; 636 if (!activated(root_focus, button_id, key) or !self.data.handle.canUndo()) return; 637 self.requestUndo(ui.RoutablePage.repoUndoClearRoute(self.data.identity) orelse return error.RouteTooLong); 638 } 639 640 fn contentAtTop(self: *View) bool { 641 const scroll = if (self.detailActive()) self.detailScroll() else self.listScroll(); 642 const rows = &scroll.child.box; 643 const id = rows.getFocus().child_id orelse return true; 644 return rows.children.getIndex(id) == 0 and scroll.y == 0; 645 } 646 647 // moving up from the sub header returns to the page's tabs 648 pub fn atTop(self: *View) bool { 649 return self.headerActive(); 650 } 651 652 // arriving from the page's tabs lands on the sub header, not the content 653 pub fn focusHeader(self: *View, root_focus: *Focus) bool { 654 root_focus.setFocus(self.headerBox().getFocus().id); 655 return true; 656 } 657 pub fn deinit(self: *View, allocator: std.mem.Allocator) void { 658 self.box.deinit(allocator); 659 } 660 pub fn clearGrid(self: *View) void { 661 self.box.clearGrid(); 662 } 663 pub fn getGrid(self: View) ?Grid { 664 return self.box.getGrid(); 665 } 666 pub fn getFocus(self: *View) *Focus { 667 return self.box.getFocus(); 668 } 669 }; 670