╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Repo.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
199 .arrow_up => .up, 200 .arrow_down => .down, 201 .mouse => |mouse| if (mouse.action == .scroll) 202 (if (mouse.action.scroll == .up) .up else .down) 203 else 204 .none, 205 else => .none, 206 }; 207 208 switch (direction) { 209 .up => { 210 switch (child.*) { 211 .repo_header => { 212 try child.input(allocator, key, root_focus); 213 }, 214 .stack => { 215 if (child.stack.getSelected()) |selected_widget| { 216 const at_top = switch (selected_widget.*) { 217 .repo_files => |*v| v.getSelectedIndex() == 0, 218 .repo_commits => |*v| v.getSelectedIndex() == 0, 219 .home_settings => |*v| v.getSelectedIndex() == 0, 220 .home_auth => |*v| v.getSelectedIndex() == 0, 221 .quit => |*v| v.getSelectedIndex() == 0, 222 else => false, 223 }; 224 if (at_top) { 225 index = header_index; 226 } else { 227 try child.input(allocator, key, root_focus); 228 } 229 } 230 }, 231 else => {}, 232 } 233 }, 234 .down => { 235 switch (child.*) { 236 .repo_header => { 237 index = stack_index; 238 }, 239 .stack => { 240 try child.input(allocator, key, root_focus); 241 }, 242 else => {}, 243 } 244 }, 245 .none => { 246 try child.input(allocator, key, root_focus); 247 }, 248 } 249 250 if (index != current_index) { 251 try root_focus.setFocus(self.box.children.keys()[index]); 252 } 253 } 254 } 255 } 256 257 pub fn clearGrid(self: *View) void { 258 self.box.clearGrid(); 259 } 260 261 pub fn getGrid(self: View) ?Grid { 262 return self.box.getGrid(); 263 } 264 265 pub fn getFocus(self: *View) *Focus { 266 return self.box.getFocus(); 267 } 268 }; 269