╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Repo.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
522 } 523 524 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { 525 const stack = &self.box.children.values()[stack_index].widget.stack; 526 if (self.getFocus().child_id) |child_id| { 527 if (self.box.children.getIndex(child_id)) |current_index| { 528 const child = &self.box.children.values()[current_index].widget; 529 var index = current_index; 530 531 const direction = inp.vertDirection(key); 532 533 switch (direction) { 534 .up => { 535 switch (child.*) { 536 .repo_header => { 537 try child.input(allocator, key, root_focus); 538 }, 539 .stack => { 540 if (child.stack.getSelected()) |selected_widget| { 541 if (selected_widget.atTop(root_focus)) { 542 index = header_index; 543 } else { 544 try child.input(allocator, key, root_focus); 545 } 546 } 547 }, 548 else => {}, 549 } 550 }, 551 .down => { 552 switch (child.*) { 553 .repo_header => { 554 if (stack.getSelected()) |selected_widget| switch (selected_widget.*) { 555 .repo_files => |*v| if (v.focusHeader(root_focus)) return, 556 .repo_commits => |*v| if (v.focusHeader(root_focus)) return, 557 .repo_refs => |*v| if (v.focusHeader(root_focus)) return, 558 .repo_events => |*v| if (v.focusHeader(root_focus)) return, 559 .repo_undo => |*v| if (v.focusHeader(root_focus)) return, 560 else => {}, 561 }; 562 index = stack_index; 563 }, 564 .stack => { 565 try child.input(allocator, key, root_focus); 566 }, 567 else => {}, 568 } 569 }, 570 .none => { 571 try child.input(allocator, key, root_focus); 572 }, 573 } 574 575 if (index != current_index) { 576 root_focus.setFocus(self.box.children.keys()[index]); 577 } 578 } 579 } 580 } 581 582 pub fn clearGrid(self: *View) void { 583 self.box.clearGrid(); 584 } 585 586 pub fn getGrid(self: View) ?Grid { 587 return self.box.getGrid(); 588 } 589 590 pub fn getFocus(self: *View) *Focus { 591 return self.box.getFocus(); 592 } 593 }; 594