╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ thread.zig ───────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
3244 const selected = self.data.selectedThread() orelse return; 3245 if (event_kind == kind and entryDraft(selected.*)) { 3246 try Data.removeDraft(self.session, allocator, author, &id); 3247 const route = draftsRoute(self.data.identity) orelse return; 3248 try self.session.navigate(route); 3249 return; 3250 } 3251 } 3252 3253 const io = self.session.io orelse return; 3254 const src = self.data.repo_source orelse return; 3255 if (!try src.canModify(io, allocator, actor, event_kind, &id)) return; 3256 const thread_id = evt.parseEventId(self.data.selected_id) catch return; 3257 3258 switch (src.repo_kind) { 3259 inline else => |repo_kind| { 3260 var any_repo = try rp.AnyRepo(repo_kind, .{}).open(io, allocator, src.localInitOpts()); 3261 defer any_repo.deinit(io, allocator); 3262 switch (any_repo) { 3263 inline else => |*repo| try evt.removeInThread(self.session.eventHost(), repo_kind, repo.self_repo_opts, io, allocator, repo, kind, &thread_id, event_kind, &id, author), 3264 } 3265 }, 3266 } 3267 3268 const id_hex = std.fmt.bytesToHex(id, .lower); 3269 const route = ui.RoutablePage.repoEventsRoute(self.data.identity, .removed, event_kind, &id_hex, null) orelse return; 3270 try self.session.navigate(route); 3271 } 3272 3273 // return to the list. 3274 fn focusList(self: *This, index: usize, root_focus: *Focus) void { 3275 root_focus.setFocus(self.listScroll(index).getFocus().id); 3276 } 3277 3278 // cross to the header tabs above the stack. 3279 fn focusHeader(self: *This, root_focus: *Focus) void { 3280 root_focus.setFocus(self.box.children.keys()[header_index]); 3281 } 3282 3283 pub fn clearGrid(self: *This) void { 3284 self.box.clearGrid(); 3285 } 3286 3287 pub fn getGrid(self: This) ?Grid { 3288 return self.box.getGrid(); 3289 } 3290 3291 pub fn getFocus(self: *This) *Focus { 3292 return self.box.getFocus(); 3293 } 3294 3295 // for the parent's "scroll up at the top jumps to the header" check: at the 3296 // top only while the header tabs hold focus, so up from the split 3297 // crosses into the tabs first. 3298 pub fn atTop(self: *This) bool { 3299 return self.headerActive(); 3300 } 3301 }; 3302 } 3303