╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Header.zig ───────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
231 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { 232 _ = allocator; 233 const current_tab = self.currentTabIndex() orelse return; 234 if (inp.moveTab(key, current_tab, self.tab_ids.count())) |new_tab| { 235 const tab_id = self.tab_ids.keys()[new_tab]; 236 root_focus.setFocus(tab_id); 237 const tab = self.scroll.child.box.children.get(tab_id) orelse return; 238 if (tab.rect) |rect| self.scroll.scrollToRect(rect); 239 } 240 } 241 242 pub fn clearGrid(self: *View) void { 243 self.scroll.clearGrid(); 244 } 245 246 pub fn getGrid(self: View) ?Grid { 247 return self.scroll.getGrid(); 248 } 249 250 pub fn getFocus(self: *View) *Focus { 251 return self.scroll.getFocus(); 252 } 253 254 pub fn getSelectedIndex(self: View) ?usize { 255 return self.currentTabIndex(); 256 } 257 258 fn currentTabIndex(self: View) ?usize { 259 const child_id = self.scroll.child.box.focus.child_id orelse return null; 260 return self.tab_ids.getIndex(child_id); 261 } 262 }; 263