╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Repo.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
494 self.clearGrid(); 495 const header = &self.box.children.values()[header_index].widget.repo_header; 496 const stack = &self.box.children.values()[stack_index].widget.stack; 497 498 // each header tab maps 1:1 to a stack child by position 499 if (header.getSelectedIndex()) |index| 500 stack.getFocus().child_id = stack.children.keys()[index]; 501 try self.box.build(allocator, constraint, root_focus); 502 } 503 504 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { 505 const stack = &self.box.children.values()[stack_index].widget.stack; 506 if (self.getFocus().child_id) |child_id| { 507 if (self.box.children.getIndex(child_id)) |current_index| { 508 const child = &self.box.children.values()[current_index].widget; 509 var index = current_index; 510 511 const direction = inp.vertDirection(key); 512 513 switch (direction) { 514 .up => { 515 switch (child.*) { 516 .repo_header => { 517 try child.input(allocator, key, root_focus); 518 }, 519 .stack => { 520 if (child.stack.getSelected()) |selected_widget| { 521 if (selected_widget.atTop(root_focus)) { 522 index = header_index; 523 } else { 524 try child.input(allocator, key, root_focus); 525 } 526 } 527 }, 528 else => {}, 529 } 530 }, 531 .down => { 532 switch (child.*) { 533 .repo_header => { 534 if (stack.getSelected()) |selected_widget| switch (selected_widget.*) { 535 .repo_files => |*v| if (v.focusHeader(root_focus)) return, 536 .repo_commits => |*v| if (v.focusHeader(root_focus)) return, 537 .repo_refs => |*v| if (v.focusHeader(root_focus)) return, 538 .repo_events => |*v| if (v.focusHeader(root_focus)) return, 539 .repo_undo => |*v| if (v.focusHeader(root_focus)) return, 540 else => {}, 541 }; 542 index = stack_index; 543 }, 544 .stack => { 545 try child.input(allocator, key, root_focus); 546 }, 547 else => {}, 548 } 549 }, 550 .none => { 551 try child.input(allocator, key, root_focus); 552 }, 553 } 554 555 if (index != current_index) { 556 root_focus.setFocus(self.box.children.keys()[index]); 557 } 558 } 559 } 560 } 561 562 pub fn clearGrid(self: *View) void { 563 self.box.clearGrid(); 564 } 565 566 pub fn getGrid(self: View) ?Grid { 567 return self.box.getGrid(); 568 } 569 570 pub fn getFocus(self: *View) *Focus { 571 return self.box.getFocus(); 572 } 573 }; 574