╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Header.zig ───────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
153 const current_tab = self.currentTabIndex() orelse return; 154 var new_tab = current_tab; 155 switch (key) { 156 .arrow_left => new_tab -|= 1, 157 .arrow_right => if (new_tab + 1 < self.tab_ids.count()) { 158 new_tab += 1; 159 }, 160 else => {}, 161 } 162 if (new_tab != current_tab) { 163 try root_focus.setFocus(self.tab_ids.keys()[new_tab]); 164 } 165 } 166 167 pub fn clearGrid(self: *View) void { 168 self.box.clearGrid(); 169 } 170 171 pub fn getGrid(self: View) ?Grid { 172 return self.box.getGrid(); 173 } 174 175 pub fn getFocus(self: *View) *Focus { 176 return self.box.getFocus(); 177 } 178 179 pub fn getSelectedIndex(self: View) ?usize { 180 return self.currentTabIndex(); 181 } 182 183 fn currentTabIndex(self: View) ?usize { 184 const child_id = self.box.focus.child_id orelse return null; 185 return self.tab_ids.getIndex(child_id); 186 } 187 }; 188