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