╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Header.zig ───────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
283 } 284 } 285 try self.box.build(allocator, constraint, root_focus); 286 } 287 288 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { 289 _ = allocator; 290 const current_tab = self.currentTabIndex() orelse return; 291 if (inp.moveTab(key, current_tab, self.tab_ids.count())) |new_tab| { 292 root_focus.setFocus(self.tab_ids.keys()[new_tab]); 293 } 294 } 295 296 pub fn clearGrid(self: *View) void { 297 self.box.clearGrid(); 298 } 299 300 pub fn getGrid(self: View) ?Grid { 301 return self.box.getGrid(); 302 } 303 304 pub fn getFocus(self: *View) *Focus { 305 return self.box.getFocus(); 306 } 307 308 pub fn getSelectedIndex(self: View) ?usize { 309 return self.currentTabIndex(); 310 } 311 312 fn currentTabIndex(self: View) ?usize { 313 const child_id = self.box.focus.child_id orelse return null; 314 return self.tab_ids.getIndex(child_id); 315 } 316 }; 317