╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Repo.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
334 if (ui.RoutablePage.Array(ui.RoutablePage.repo_route_max_len).from(self.data.identity.slice())) |identity| 335 self.session.data.current_page = .{ .repo_auth = identity }; 336 }, 337 // the quit tab is tty-only and not a route, so leave current_page 338 // alone (nothing to mirror into the url). 339 .quit => {}, 340 // the files tab (this page's directory route) 341 else => self.session.data.current_page = .{ .repo_files = self.data.route_name }, 342 } 343 } 344 try self.box.build(allocator, constraint, root_focus); 345 } 346 347 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { 348 if (self.getFocus().child_id) |child_id| { 349 if (self.box.children.getIndex(child_id)) |current_index| { 350 const child = &self.box.children.values()[current_index].widget; 351 var index = current_index; 352 353 const direction = inp.vertDirection(key); 354 355 switch (direction) { 356 .up => { 357 switch (child.*) { 358 .repo_header => { 359 try child.input(allocator, key, root_focus); 360 }, 361 .stack => { 362 if (child.stack.getSelected()) |selected_widget| { 363 const at_top = switch (selected_widget.*) { 364 .repo_files => |*v| v.getSelectedIndex() == 0, 365 .repo_commits => |*v| v.getSelectedIndex() == 0, 366 .repo_refs => |*v| v.getSelectedIndex() == 0, 367 .repo_issues => |*v| v.getSelectedIndex() == 0, 368 .home_settings => |*v| v.getSelectedIndex() == 0, 369 .home_auth => |*v| v.getSelectedIndex() == 0, 370 .quit => |*v| v.getSelectedIndex() == 0, 371 else => false, 372 }; 373 if (at_top) { 374 index = header_index; 375 } else { 376 try child.input(allocator, key, root_focus); 377 } 378 } 379 }, 380 else => {}, 381 } 382 }, 383 .down => { 384 switch (child.*) { 385 .repo_header => { 386 index = stack_index; 387 }, 388 .stack => { 389 try child.input(allocator, key, root_focus); 390 }, 391 else => {}, 392 } 393 }, 394 .none => { 395 try child.input(allocator, key, root_focus); 396 }, 397 } 398 399 if (index != current_index) { 400 root_focus.setFocus(self.box.children.keys()[index]); 401 } 402 } 403 } 404 } 405 406 pub fn clearGrid(self: *View) void { 407 self.box.clearGrid(); 408 } 409 410 pub fn getGrid(self: View) ?Grid { 411 return self.box.getGrid(); 412 } 413 414 pub fn getFocus(self: *View) *Focus { 415 return self.box.getFocus(); 416 } 417 }; 418