╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Repo.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
211 }; 212 const events_view: ui.RoutablePage.EventsView = switch (route) { 213 .repo_events => |e| e.view, 214 else => .active, 215 }; 216 const events_moment: ?u64 = switch (route) { 217 .repo_events => |e| e.moment, 218 else => null, 219 }; 220 const events_selected: []const u8 = switch (route) { 221 .repo_events => |*e| e.selected.slice(), 222 else => "", 223 }; 224 const roles_start: usize = switch (route) { 225 .repo_roles => |r| r.start, 226 else => 0, 227 }; 228 229 // where the on-disk repo lives (null keeps the views' empty fallback), plus 230 // the repo and owner-name metadata the header shows. local mode already 231 // knows all three; the server paths resolve them from the admin db. 232 var source: ?ui.RepoSource = null; 233 var repo_id_maybe: ?[evt.event_id_size]u8 = null; 234 var repo: evt.Repo.Record = undefined; 235 // local mode owns its repo 236 var role: evt.Repo.Role = .owner; 237 var owner_name: []const u8 = undefined; 238 if (session.local) |local| { 239 source = local; 240 // local routes elide the identity, so the display name comes from the 241 // repo's directory rather than the route. 242 repo = .{ 243 .event = .{ 244 .user_id = "", 245 .name = try arena.allocator().dupe(u8, std.Io.Dir.path.basename(local.path)), 246 .description = "", 247 // local mode shows every tab 248 .discuss_role = .read, 249 .issue_role = .read, 250 .patch_role = .read, 251 }, 252 }; 253 owner_name = ""; 254 } else { 255 const haxy_moment = session.haxy_moment orelse return error.NoMoment; 256 const io = session.io orelse return error.NoMoment; 257 const users_dir = session.users_dir orelse return error.NoMoment; 258 const found = (try evt.readRepoByOwnerAndName(io, arena.child_allocator, arena, haxy_moment, users_dir, repo_identity.owner, repo_identity.name, session.userId())) orelse return error.NotFound; 259 // a repo the session can't read doesn't exist to it 260 role = found.role orelse return error.NotFound; 261 repo = found.repo; 262 repo_id_maybe = found.event_id; 263 264 // resolve the creating user so the header can show their name to the left 265 // of the repo title. 266 const owner = (try evt.User.readById(DB, hash_kind, haxy_moment, arena, repo.event.user_id)) orelse return error.NotFound; 267 owner_name = owner.event.name; 268 269 // the repo's working copy lives in its owner's dir. 270 source = .{ 271 .path = try evt.repoPath(arena.allocator(), users_dir, repo.event.user_id, &found.event_id), 272 .repo_kind = .xit, 273 }; 274 } 275 276 const handle = ui.RepoHandle{ 277 .location = .{ .repo = try arena.allocator().dupe(u8, repo_identity.identity) }, 278 .viewer = try ui.Viewer.init(session, arena, role), 279 }; 280 281 // open the repo once for every tab. files and changes share a ref or revision. 282 // no filesystem (wasm), nowhere to look, or a failed open: empty tabs. 283 // the events tab needs write access, like undo 284 if (route == .repo_events and !handle.canWrite()) return error.NotFound; 285 // a tab that is off doesn't exist 286 const route_thread_kind: ?evt.EventKind = switch (route) { 287 .repo_discussions => .discuss, 288 .repo_issues => .issue, 289 .repo_patches => .patch, 290 else => null, 291 }; 292 if (route_thread_kind) |kind| if (repo.event.threadRole(kind) == null) return error.NotFound; 293 const undo_index = if (route == .repo_undo) route.repo_undo.index else null; 294 const undo_clear = route == .repo_undo and route.repo_undo.clear; 295 // only xit repos have undo history, so it's read in their branch below 296 var undo_data: ?Undo = null; 297 // only the owner sees the settings, which show the repo's hash kind 298 var settings: ?Settings = null; 299 const files, const changes, const refs, var discussions, var issues, var patches, const events = blk: { 300 read: { 301 const io = session.io orelse break :read; 302 const src = source orelse break :read; 303 const gpa = arena.child_allocator; 304 switch (src.repo_kind) { 305 inline else => |repo_kind| { 306 var any_repo = rp.AnyRepo(repo_kind, .{}).open(io, gpa, src.localInitOpts()) catch break :read; 307 defer any_repo.deinit(io, gpa); 308 switch (any_repo) { 309 inline else => |*opened| { 310 // local mode: bring the event db up to date with the events branch 311 if (session.local != null) { 312 try evt.consume(.local, .repo, repo_kind, opened.self_repo_opts, io, gpa, opened, evt.events_ref, &.{}); 313 try pch.refreshBranches(.local, repo_kind, opened.self_repo_opts, io, gpa, opened, null, null); 314 } 315 if (session.data.host_kind == .server and handle.canUndo()) { 316 // a server page always resolved its repo id 317 const repo_id = repo_id_maybe orelse unreachable; 318 settings = .{ 319 .identity = try arena.allocator().dupe(u8, repo_identity.identity), 320 .name = repo.event.name, 321 .description = repo.event.description, 322 .access = repo.event.read_access, 323 .discuss_role = repo.event.discuss_role, 324 .issue_role = repo.event.issue_role, 325 .patch_role = repo.event.patch_role, 326 .hash_kind = opened.self_repo_opts.hash, 327 .view = if (route == .repo_roles) .roles else .settings, 328 .roles = try Roles.init(io, gpa, arena, session.haxy_moment orelse return error.NoMoment, session.users_dir orelse return error.NoMoment, repo_identity.identity, repo.event.user_id[0..evt.event_id_size], &repo_id, roles_start), 329 }; 330 } 331 // tabs switch in-page, so every tab's data is read here 332 if (repo_kind == .xit and handle.canWrite()) { 333 undo_data = Undo.init(opened.self_repo_opts, arena, opened, session.haxy_moment, repo_identity.identity, undo_index, handle) catch |err| switch (err) { 334 error.OutOfMemory => return err, 335 else => .{ .identity = try arena.allocator().dupe(u8, repo_identity.identity), .handle = handle, .failure = @errorName(err) }, 336 }; 337 } 338 // a merge: route stands for the log of what the merge brought in 339 const ref_or_oid: ?ui.RoutablePage.RefOrOid, const ref_value, const base_oid = if (commits_merge.len == 0) 340 .{ requested_ref_or_oid, requested_ref_value, commits_base_oid } 341 else merged: { 342 const merged = try Commits.resolveMerge(repo_kind, opened.self_repo_opts, arena, opened, io, gpa, commits_merge); 343 break :merged .{ .object, merged.oid, merged.base_oid }; 344 }; 345 const files_data = if (patchrev_id.len != 0) 346 try Files.initPatchRev(repo_kind, opened.self_repo_opts, arena, opened, io, gpa, handle, patchrev_id, files_dir, files_line) 347 else 348 try Files.init(repo_kind, opened.self_repo_opts, arena, opened, io, gpa, handle, ref_or_oid, ref_value, files_dir, files_line, files_find); 349 const changes_data: Changes = if (route == .repo_diff) 350 .{ .diff = try Diff.init(repo_kind, opened.self_repo_opts, arena, opened, io, gpa, route.repo_diff) } 351 else if (patchrev_id.len != 0) diff: { 352 const diff_route = ui.RoutablePage.repoPatchRevDiffRoute(repo_identity.identity, patchrev_id, 0, "") orelse return error.RouteTooLong; 353 break :diff .{ .diff = try Diff.init(repo_kind, opened.self_repo_opts, arena, opened, io, gpa, diff_route.repo_diff) }; 354 } else .{ .commits = try Commits.init(repo_kind, opened.self_repo_opts, arena, opened, io, gpa, session.haxy_moment, handle, ref_or_oid, ref_value, commits_message, base_oid, commits_search, commits_from) }; 355 const target_branch = if (files_data.ref_or_oid == .branch) files_data.ref_or_oid_value else ""; 356 break :blk .{ 357 files_data, 358 changes_data, 359 try Refs.init(repo_kind, opened.self_repo_opts, arena, opened, io, gpa, repo_identity.identity, refs_kind, refs_from, refs_search), 360 try Discussions.init(repo_kind, opened.self_repo_opts, arena, opened, io, session.haxy_moment, repo_identity.identity, discussions_label, discussions_search, discussions_selected, discussions_comment, discussions_comments_start, discussions_view, tabViewer(handle, repo, .discuss)), 361 try Issues.init(repo_kind, opened.self_repo_opts, arena, opened, io, session.haxy_moment, repo_identity.identity, issues_label, issues_search, issues_selected, issues_comment, issues_comments_start, issues_theirs, issues_view, tabViewer(handle, repo, .issue)), 362 try Patches.init(repo_kind, opened.self_repo_opts, arena, opened, io, session.haxy_moment, session, repo_id_maybe, repo_identity.identity, target_branch, patches_label, patches_search, patches_selected, patches_comment, patches_comments_start, patches_theirs, patches_view, tabViewer(handle, repo, .patch)), 363 try Events.init(repo_kind, opened.self_repo_opts, arena, opened, io, session.haxy_moment, repo_identity.identity, repo.event, events_view, events_kind, events_selected, events_moment, session.local != null, session.data.sync_failure), 364 }; 365 }, 366 } 367 }, 368 } 369 } 370 const aa = arena.allocator(); 371 break :blk .{ 372 try Files.emptyResult(aa, handle, requested_ref_or_oid orelse .branch, requested_ref_value, files_dir), 373 Changes{ .commits = try Commits.emptyResult(aa, handle, requested_ref_or_oid orelse .branch, requested_ref_value, commits_base_oid) }, 374 try Refs.emptyResult(arena, repo_identity.identity, refs_kind, refs_from, refs_search), 375 try Discussions.emptyResult(aa, repo_identity.identity, discussions_label, discussions_search, discussions_selected, discussions_comment, discussions_comments_start, discussions_view), 376 try Issues.emptyResult(aa, repo_identity.identity, issues_label, issues_search, issues_selected, issues_comment, issues_comments_start, issues_theirs, issues_view), 377 try Patches.emptyResult(aa, repo_identity.identity, patches_label, patches_search, patches_selected, patches_comment, patches_comments_start, patches_theirs, patches_view), 378 try Events.empty(aa, repo_identity.identity, events_view, session.local != null, session.data.sync_failure), 379 }; 380 }; 381 if (route == .repo_undo and undo_data == null) return error.NotFound; 382 if ((route == .repo_settings or route == .repo_roles) and settings == null) return error.NotFound; 383 if (undo_data) |*undo| undo.clear = undo_clear; 384 discussions.repo_source = source; 385 issues.repo_source = source; 386 patches.repo_source = source; 387 patches.repo_id = repo_id_maybe; 388 389 return .{ 390 // use the files tab's resolved ref for the header 391 .header = try Header.init(arena, repo.event.name, owner_name, files.ref_or_oid, files.ref_or_oid_value, discussions.label, issues.label, patches.label), 392 .repo = repo, 393 .handle = handle, 394 .files = files, 395 .changes = changes, 396 .refs = refs, 397 .discussions = discussions, 398 .issues = issues, 399 .patches = patches, 400 .events = events, 401 .undo = undo_data, 402 .settings = settings, 403 .quit = Quit.init(), 404 }; 405 } 406 407 // the viewer a tab's comment bar sees, which is none below the tab's role 408 fn tabViewer(handle: ui.RepoHandle, repo: evt.Repo.Record, kind: evt.EventKind) ?ui.Viewer { 409 const viewer = handle.viewer orelse return null; 410 const tab_role = repo.event.threadRole(kind) orelse return null; 411 return if (viewer.role.atLeast(tab_role)) viewer else null; 412 } 413 414 pub const View = struct { 415 box: wgt.Box(ui.Widget), 416 417 const header_index: usize = 0; 418 const stack_index: usize = 1; 419 420 pub fn init(allocator: std.mem.Allocator, data: *const Self, session: *ui.Session) !View { 421 var box = try wgt.Box(ui.Widget).init(allocator, .{ .border = null, .round_corners = true, .direction = .vert }); 422 errdefer box.deinit(allocator); 423 424 // build the header first so we can grab the files-tab id for the user 425 // view (it focuses there after login). 426 { 427 var header_view = try Header.View.init(allocator, data, session); 428 errdefer header_view.deinit(allocator); 429 try box.children.put(allocator, header_view.getFocus().id, .{ .widget = .{ .repo_header = header_view }, .rect = null, .min_size = null }); 430 } 431 432 { 433 var stack = try wgt.Stack(ui.Widget).init(allocator); 434 errdefer stack.deinit(allocator); 435 436 // files — the default tab: the current directory's listing. 437 { 438 var files_view = try Files.View.init(allocator, &data.files, session); 439 errdefer files_view.deinit(allocator); 440 try stack.children.put(allocator, files_view.getFocus().id, .{ .repo_files = files_view }); 441 } 442 443 switch (data.changes) { 444 .diff => |*diff| { 445 var diff_view = try Diff.View.init(allocator, diff, session); 446 errdefer diff_view.deinit(allocator); 447 try stack.children.put(allocator, diff_view.getFocus().id, .{ .diff_view = diff_view }); 448 }, 449 .commits => |*commits| { 450 var commits_view = try Commits.View.init(allocator, commits, session); 451 errdefer commits_view.deinit(allocator); 452 try stack.children.put(allocator, commits_view.getFocus().id, .{ .repo_commits = commits_view }); 453 }, 454 } 455 456 // refs — the repo's branches and tags. 457 { 458 var refs_view = try Refs.View.init(allocator, &data.refs, session); 459 errdefer refs_view.deinit(allocator); 460 try stack.children.put(allocator, refs_view.getFocus().id, .{ .repo_refs = refs_view }); 461 } 462 463 // discussions and their comment permalinks. 464 if (data.repo.event.discuss_role != null) { 465 var discussions_view = try Discussions.View.init(allocator, &data.discussions, session); 466 errdefer discussions_view.deinit(allocator); 467 try stack.children.put(allocator, discussions_view.getFocus().id, .{ .repo_discussions = discussions_view }); 468 } 469 470 // issues — the repo's issue tracker and comment permalinks. 471 if (data.repo.event.issue_role != null) { 472 var issues_view = try Issues.View.init(allocator, &data.issues, session); 473 errdefer issues_view.deinit(allocator); 474 try stack.children.put(allocator, issues_view.getFocus().id, .{ .repo_issues = issues_view }); 475 } 476 477 // patches and their comment permalinks. 478 if (data.repo.event.patch_role != null) { 479 var patches_view = try Patches.View.init(allocator, &data.patches, session); 480 errdefer patches_view.deinit(allocator); 481 try stack.children.put(allocator, patches_view.getFocus().id, .{ .repo_patches = patches_view }); 482 } 483 484 if (data.handle.canWrite()) { 485 var events_view = try Events.View.init(allocator, &data.events, session); 486 errdefer events_view.deinit(allocator); 487 try stack.children.put(allocator, events_view.getFocus().id, .{ .repo_events = events_view }); 488 } 489 490 if (data.undo) |*undo| { 491 var undo_view = try Undo.View.init(allocator, undo, session); 492 errdefer undo_view.deinit(allocator); 493 try stack.children.put(allocator, undo_view.getFocus().id, .{ .repo_undo = undo_view }); 494 } 495 496 if (data.settings) |*settings| { 497 var settings_view = try Settings.View.init(allocator, settings, session); 498 errdefer settings_view.deinit(allocator); 499 try stack.children.put(allocator, settings_view.getFocus().id, .{ .repo_settings = settings_view }); 500 } 501 502 // the header shows new repo with a login, and new user without one 503 // and user only outside local mode, so keep the stack's children 504 // 1:1 with the tabs by skipping the same views. 505 const identity = try session.page_arena.allocator().print("{s}:{s}", .{ data.header.owner_name, data.header.name }); 506 if (session.data.user_id != null) { 507 const route = ui.RoutablePage{ .repo_repo_new = ui.RoutablePage.Array(ui.RoutablePage.repo_route_max_len).from(identity) orelse return error.RouteTooLong }; 508 var new_repo_view = try ui.NewRepo.View.init(allocator, session, route); 509 errdefer new_repo_view.deinit(allocator); 510 try stack.children.put(allocator, new_repo_view.getFocus().id, .{ .new_repo = new_repo_view }); 511 } else if (session.data.host_kind == .server) { 512 const route = ui.RoutablePage{ .repo_user_new = ui.RoutablePage.Array(ui.RoutablePage.repo_route_max_len).from(identity) orelse return error.RouteTooLong }; 513 var new_user_view = try ui.NewUser.View.init(allocator, session, route); 514 errdefer new_user_view.deinit(allocator); 515 try stack.children.put(allocator, new_user_view.getFocus().id, .{ .new_user = new_user_view }); 516 } 517 518 if (session.data.host_kind == .server) { 519 var user_view = try ui.UserSettings.initView(allocator, session); 520 errdefer user_view.deinit(allocator); 521 try stack.children.put(allocator, user_view.getFocus().id, user_view); 522 } 523 524 if (session.is_terminal) { 525 var quit_view = try Quit.View.init(allocator, session); 526 errdefer quit_view.deinit(allocator); 527 try stack.children.put(allocator, quit_view.getFocus().id, .{ .quit = quit_view }); 528 } 529 530 try box.children.put(allocator, stack.getFocus().id, .{ .widget = .{ .stack = stack }, .rect = null, .min_size = null }); 531 } 532 533 var self = View{ .box = box }; 534 // a page opens on its tabs, except that search results open in the 535 // tab's own search box. 536 const results = data.files.find != null or 537 (data.changes == .commits and data.changes.commits.search != null) or 538 data.discussions.search != null or data.issues.search != null or data.patches.search != null; 539 self.getFocus().child_id = box.children.keys()[if (results) stack_index else header_index]; 540 return self; 541 } 542 543 pub fn deinit(self: *View, allocator: std.mem.Allocator) void { 544 self.box.deinit(allocator); 545 } 546 547 pub fn build(self: *View, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) !void { 548 self.clearGrid(); 549 const header = &self.box.children.values()[header_index].widget.repo_header; 550 const stack = &self.box.children.values()[stack_index].widget.stack; 551 552 // each header tab maps 1:1 to a stack child by position 553 if (header.getSelectedIndex()) |index| 554 stack.getFocus().child_id = stack.children.keys()[index]; 555 try self.box.build(allocator, constraint, root_focus); 556 } 557 558 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { 559 const stack = &self.box.children.values()[stack_index].widget.stack; 560 if (self.getFocus().child_id) |child_id| { 561 if (self.box.children.getIndex(child_id)) |current_index| { 562 const child = &self.box.children.values()[current_index].widget; 563 var index = current_index; 564 565 const direction = inp.vertDirection(key); 566 567 switch (direction) { 568 .up => { 569 switch (child.*) { 570 .repo_header => { 571 try child.input(allocator, key, root_focus); 572 }, 573 .stack => { 574 if (child.stack.getSelected()) |selected_widget| { 575 if (selected_widget.atTop(root_focus)) { 576 index = header_index; 577 } else { 578 try child.input(allocator, key, root_focus); 579 } 580 } 581 }, 582 else => {}, 583 } 584 }, 585 .down => { 586 switch (child.*) { 587 .repo_header => { 588 if (stack.getSelected()) |selected_widget| switch (selected_widget.*) { 589 .repo_files => |*v| if (v.focusHeader(root_focus)) return, 590 .repo_commits => |*v| if (v.focusHeader(root_focus)) return, 591 .repo_refs => |*v| if (v.focusHeader(root_focus)) return, 592 .repo_events => |*v| if (v.focusHeader(root_focus)) return, 593 .repo_undo => |*v| if (v.focusHeader(root_focus)) return, 594 .repo_settings => |*v| if (v.focusHeader(root_focus)) return, 595 else => {}, 596 }; 597 index = stack_index; 598 }, 599 .stack => { 600 try child.input(allocator, key, root_focus); 601 }, 602 else => {}, 603 } 604 }, 605 .none => { 606 try child.input(allocator, key, root_focus); 607 }, 608 } 609 610 if (index != current_index) { 611 root_focus.setFocus(self.box.children.keys()[index]); 612 } 613 } 614 } 615 } 616 617 pub fn clearGrid(self: *View) void { 618 self.box.clearGrid(); 619 } 620 621 pub fn getGrid(self: View) ?Grid { 622 return self.box.getGrid(); 623 } 624 625 pub fn getFocus(self: *View) *Focus { 626 return self.box.getFocus(); 627 } 628 }; 629