╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ────────╮ │src/ui/widget.zig│ ╰─────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1091 pub fn selected(self: *Radio) []const u8 { │ │1077 - const index = self.box.children.getIndex(self.box.getFocus().child_id orelse unreachable) orelse unreachable; │ │1078 - return self.values[index]; │ │1092 + const options = self.optionFlow(); │ │1093 + return self.values[options.indexOfFocusId(options.focus.child_id orelse unreachable) orelse unreachable]; │ │1094 } │ │1095 │ │1096 pub fn build(self: *Radio, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) !void {│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1097 self.clearGrid(); │ │1083 - const selected_id = self.box.getFocus().child_id; │ │1084 - for (self.box.children.keys(), self.box.children.values()) |id, *child| { │ │1085 - child.widget.text_box.options.border = if (id == selected_id) .single else .hidden; │ │1098 + const options = self.optionFlow(); │ │1099 + const selected_id = options.focus.child_id; │ │1100 + for (options.text_boxes.items) |*option| { │ │1101 + option.options.border = if (option.getFocus().id == selected_id) .single else .hidden;│ │1102 } │ │1103 try self.box.build(allocator, constraint, root_focus); │ │1104 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1105 │ │1106 + // left and right step through the options in order, however they wrap │ │1107 pub fn input(self: *Radio, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { │ │1108 _ = allocator; │ │1092 - const ids = self.box.children.keys(); │ │1093 - const index = self.box.children.getIndex(self.box.getFocus().child_id orelse return) orelse return; │ │1109 + const options = self.optionFlow(); │ │1110 + const index = options.indexOfFocusId(options.focus.child_id orelse return) orelse return; │ │1111 + const option_boxes = options.text_boxes.items; │ │1112 switch (key) { │ │1095 - .arrow_left => if (index > 0) root_focus.setFocus(ids[index - 1]), │ │1096 - .arrow_right => if (index + 1 < ids.len) root_focus.setFocus(ids[index + 1]), │ │1113 + .arrow_left => if (index > 0) root_focus.setFocus(option_boxes[index - 1].getFocus().id), │ │1114 + .arrow_right => if (index + 1 < option_boxes.len) root_focus.setFocus(option_boxes[index + 1].getFocus().id),│ │1115 else => {}, │ │1116 } │ │1117 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───────────────╮ │src/ui/widget/thread.zig│ ╰────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1338 │ │1339 fn removeEvent(self: *This, allocator: std.mem.Allocator, event_kind: evt.EventKind, id: [evt.event_id_size]u8) !void {│ │1340 if (comptime wasm) return; │ │1341 - const actor = (try self.session.authorize(self.data.identity, .read)) orelse return; │ │1341 + const actor = (try self.session.authorize(self.data.identity, .read, kind)) orelse return; │ │1342 const author = actor.author; │ │1343 │ │1344 if (comptime supports_drafts) { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │1354 const io = self.session.io orelse return; │ │1355 const source = self.data.repo_source orelse return; │ │1356 if (!try source.canModify(io, allocator, actor, event_kind, &id)) return; │ │1357 + const thread_id = evt.parseEventId((self.entry orelse return).id) catch return;│ │1358 │ │1359 switch (source.repo_kind) { │ │1360 inline else => |repo_kind| { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1361 var any_repo = try rp.AnyRepo(repo_kind, .{}).open(io, allocator, source.localInitOpts()); │ │1362 defer any_repo.deinit(io, allocator); │ │1363 switch (any_repo) { │ │1363 - inline else => |*repo| try evt.remove(self.session.eventHost(), .repo, repo_kind, repo.self_repo_opts, io, allocator, repo, &id, event_kind, author), │ │1364 + 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),│ │1365 } │ │1366 }, │ │1367 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1376 const entry = self.entry orelse return; │ │1377 const io = self.session.io orelse return; │ │1378 const source = self.data.repo_source orelse return; │ │1378 - const actor = (try self.session.authorize(self.data.identity, .read)) orelse return; │ │1379 + const actor = (try self.session.authorize(self.data.identity, .read, kind)) orelse return;│ │1380 const author = actor.author; │ │1381 const status = (statusChange(entryStatus(entry)) orelse return).status; │ │1382 const id = try evt.parseEventId(entry.id); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2580 const io = self.session.io orelse return; │ │2581 const src = self.data.repo_source orelse return; │ │2582 const entry = self.data.selectedThread() orelse return; │ │2582 - const author = ((try self.session.authorize(self.data.identity, .write)) orelse return).author; │ │2583 + const author = ((try self.session.authorize(self.data.identity, .write, kind)) orelse return).author;│ │2584 const form = self.formBox() orelse return; │ │2585 │ │2586 // gather the inputs by name; the d<n> hunk inputs appear in chunk order │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2643 if (comptime wasm) return; │ │2644 const io = self.session.io orelse return; │ │2645 const src = self.data.repo_source orelse return; │ │2645 - const actor = (try self.session.authorize(self.data.identity, .read)) orelse return; │ │2646 + const actor = (try self.session.authorize(self.data.identity, .read, kind)) orelse return;│ │2647 const author = actor.author; │ │2648 const form = self.formBox() orelse return; │ │2649 const body_input = try formField(form, "body"); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2671 switch (any_repo) { │ │2672 inline else => |*repo| if (editing) { │ │2673 const comment_id = evt.parseEventId(self.data.comment_id) catch return; │ │2673 - try evt.Comment.update(self.session.eventHost(), repo_kind, repo.self_repo_opts, io, allocator, repo, &thread_id, &comment_id, body, author); │ │2674 + try evt.Comment.update(self.session.eventHost(), repo_kind, repo.self_repo_opts, io, allocator, repo, kind, &thread_id, &comment_id, body, author); │ │2675 event_id_hex = std.fmt.bytesToHex(comment_id, .lower); │ │2676 } else { │ │2676 - event_id_hex = try evt.Comment.create(self.session.eventHost(), repo_kind, repo.self_repo_opts, io, allocator, repo, &thread_id, &parent_id, body, author); │ │2677 + event_id_hex = try evt.Comment.create(self.session.eventHost(), repo_kind, repo.self_repo_opts, io, allocator, repo, kind, &thread_id, &parent_id, body, author);│ │2678 }, │ │2679 } │ │2680 }, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯