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