╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Repo.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
277 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { 278 if (self.getFocus().child_id) |child_id| { 279 if (self.box.children.getIndex(child_id)) |current_index| { 280 const child = &self.box.children.values()[current_index].widget; 281 var index = current_index; 282 283 const direction = inp.vertDirection(key); 284 285 switch (direction) { 286 .up => { 287 switch (child.*) { 288 .repo_header => { 289 try child.input(allocator, key, root_focus); 290 }, 291 .stack => { 292 if (child.stack.getSelected()) |selected_widget| { 293 const at_top = switch (selected_widget.*) { 294 .repo_files => |*v| v.getSelectedIndex() == 0, 295 .repo_commits => |*v| v.getSelectedIndex() == 0, 296 .repo_refs => |*v| v.getSelectedIndex() == 0, 297 .repo_issues => |*v| v.getSelectedIndex() == 0, 298 .home_settings => |*v| v.getSelectedIndex() == 0, 299 .home_auth => |*v| v.getSelectedIndex() == 0, 300 .quit => |*v| v.getSelectedIndex() == 0, 301 else => false, 302 }; 303 if (at_top) { 304 index = header_index; 305 } else { 306 try child.input(allocator, key, root_focus); 307 } 308 } 309 }, 310 else => {}, 311 } 312 }, 313 .down => { 314 switch (child.*) { 315 .repo_header => { 316 index = stack_index; 317 }, 318 .stack => { 319 try child.input(allocator, key, root_focus); 320 }, 321 else => {}, 322 } 323 }, 324 .none => { 325 try child.input(allocator, key, root_focus); 326 }, 327 } 328 329 if (index != current_index) { 330 root_focus.setFocus(self.box.children.keys()[index]); 331 } 332 } 333 } 334 } 335 336 pub fn clearGrid(self: *View) void { 337 self.box.clearGrid(); 338 } 339 340 pub fn getGrid(self: View) ?Grid { 341 return self.box.getGrid(); 342 } 343 344 pub fn getFocus(self: *View) *Focus { 345 return self.box.getFocus(); 346 } 347 }; 348