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