╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Branches.zig ─────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
245 const row_box = &rows.children.values()[current].widget.box; 246 const button_id = row_box.getFocus().child_id orelse return; 247 if (row_box.children.getIndex(button_id) != 1 or !inp.activated(root_focus, button_id, key)) return; 248 try self.act(allocator, .unprotect, self.data.names[current - add_index - 1]); 249 }, 250 } 251 } 252 253 // the terminal performs the action itself; the web posts the form instead 254 fn act(self: *View, allocator: std.mem.Allocator, action: Action, branch: []const u8) !void { 255 if (comptime wasm) return; 256 const io = self.session.io orelse return; 257 const users_dir = self.session.users_dir orelse return; 258 const actor = (try self.session.authorize(self.data.identity, .owner, null)) orelse return; 259 if (try perform(io, allocator, users_dir, actor, self.data.identity, action, branch)) |failure| { 260 self.session.data.form_feedback = .{ .repo_branches = .{ .failure = failure, .name = try self.session.arena.allocator().dupe(u8, branch), .default = action == .default } }; 261 return; 262 } 263 try self.session.navigate(ui.RoutablePage.repoBranchesRoute(self.data.identity) orelse return error.RouteTooLong); 264 } 265 266 pub fn clearGrid(self: *View) void { 267 self.scroll.clearGrid(); 268 } 269 270 pub fn getGrid(self: View) ?Grid { 271 return self.scroll.getGrid(); 272 } 273 274 pub fn getFocus(self: *View) *Focus { 275 return self.scroll.getFocus(); 276 } 277 278 // up leaves the view from the explanatory text 279 pub fn atTop(self: *View) bool { 280 return self.contentBox().getFocus().child_id == self.aboutBox().getFocus().id; 281 } 282 }; 283