╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Fork.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯
275 const stack = &self.box.children.values()[stack_index].widget.stack; 276 const current_id = self.box.getFocus().child_id orelse return; 277 const current_index = self.box.children.getIndex(current_id) orelse return; 278 const child = &self.box.children.values()[current_index].widget; 279 var next_index = current_index; 280 switch (inp.vertDirection(key)) { 281 .up => switch (child.*) { 282 .fork_header => try child.input(allocator, key, root_focus), 283 .stack => if (stack.getSelected()) |selected| { 284 if (selected.atTop(root_focus)) next_index = header_index else try child.input(allocator, key, root_focus); 285 }, 286 else => {}, 287 }, 288 .down => switch (child.*) { 289 .fork_header => { 290 if (stack.getSelected()) |selected| switch (selected.*) { 291 .repo_patch_detail => |*view| if (view.focusFirst(root_focus)) return, 292 .repo_files => |*view| if (view.focusHeader(root_focus)) return, 293 .repo_commits => |*view| if (view.focusHeader(root_focus)) return, 294 .user_notifications => |*view| if (view.focusHeader(root_focus)) return, 295 else => {}, 296 }; 297 next_index = stack_index; 298 }, 299 .stack => try child.input(allocator, key, root_focus), 300 else => {}, 301 }, 302 .none => try child.input(allocator, key, root_focus), 303 } 304 if (next_index != current_index) root_focus.setFocus(self.box.children.keys()[next_index]); 305 } 306 307 pub fn clearGrid(self: *View) void { 308 self.box.clearGrid(); 309 } 310 311 pub fn getGrid(self: View) ?Grid { 312 return self.box.getGrid(); 313 } 314 315 pub fn getFocus(self: *View) *Focus { 316 return self.box.getFocus(); 317 } 318 }; 319