╭ changed ───────────────╮ │src/ui/widget/thread.zig│ ╰────────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────╮ │← previous│ ╰──────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1670 errdefer prompt.deinit(allocator); │ │1671 try box.children.put(allocator, prompt.getFocus().id, .{ .widget = .{ .text = prompt }, .rect = null, .min_size = null }); │ │1672 │ │1636 - var button = try wgt.TextBox.init(allocator, label, .{ .border_style = .single, .rounded_corners = true, .wrap_kind = .none }); │ │1637 - errdefer button.deinit(allocator); │ │1638 - button.getFocus().focusable = true; │ │1639 - button.getFocus().kind = .{ .custom = "submit" }; │ │1640 - try box.children.put(allocator, button.getFocus().id, .{ .widget = .{ .text_box = button }, .rect = null, .min_size = null }); │ │1641 - box.getFocus().child_id = button.getFocus().id; │ │1673 + for (buttons, 0..) |options, index| { │ │1674 + var button = try wgt.TextBox.init(allocator, options.label, .{ .border_style = .single, .rounded_corners = true, .wrap_kind = .none });│ │1675 + errdefer button.deinit(allocator); │ │1676 + button.getFocus().focusable = true; │ │1677 + button.getFocus().kind = .{ .custom = options.action }; │ │1678 + try box.children.put(allocator, button.getFocus().id, .{ .widget = .{ .text_box = button }, .rect = null, .min_size = null }); │ │1679 + if (index == 0) box.getFocus().child_id = button.getFocus().id; │ │1680 + } │ │1681 │ │1682 return Center.init(allocator, .{ .box = box }); │ │1683 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2210 │ │2211 fn confirmationFormInput(self: *This, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { │ │2212 const form = self.confirmationForm() orelse return; │ │2174 - const button_id = form.children.keys()[1]; │ │2213 + const child_id = form.getFocus().child_id orelse return; │ │2214 + const index = form.children.getIndex(child_id) orelse return; │ │2215 switch (key) { │ │2176 - .arrow_up, .back_tab => self.focusHeader(root_focus), │ │2177 - .enter => try self.submitConfirmation(allocator), │ │2178 - .mouse => |mouse| if (inp.leftClickOn(root_focus, button_id, mouse)) try self.submitConfirmation(allocator), │ │2216 + .arrow_up, .back_tab => if (index > 1) │ │2217 + root_focus.setFocus(form.children.keys()[index - 1]) │ │2218 + else │ │2219 + self.focusHeader(root_focus), │ │2220 + .arrow_down, .tab => if (index + 1 < form.children.count()) root_focus.setFocus(form.children.keys()[index + 1]),│ │2221 + .enter => try self.submitConfirmation(allocator, index), │ │2222 + .mouse => |mouse| for (form.children.keys()[1..], 1..) |button_id, button_index| { │ │2223 + if (inp.leftClickOn(root_focus, button_id, mouse)) { │ │2224 + try self.submitConfirmation(allocator, button_index); │ │2225 + break; │ │2226 + } │ │2227 + }, │ │2228 else => {}, │ │2229 } │ │2230 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2555 try self.session.navigate(route); │ │2556 } │ │2557 │ │2509 - fn submitConfirmation(self: *This, allocator: std.mem.Allocator) !void { │ │2558 + fn submitConfirmation(self: *This, allocator: std.mem.Allocator, button_index: usize) !void {│ │2559 switch (confirmation(self.data.view) orelse return) { │ │2560 .publish => if (comptime supports_drafts) { │ │2561 if (comptime wasm) return; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2565 const route = listRoute(self.data.identity, @enumFromInt(0), "", entry.id) orelse return;│ │2566 try self.session.navigate(route); │ │2567 } else unreachable, │ │2568 + .merge => if (comptime supports_merge) { │ │2569 + if (comptime wasm) return; │ │2570 + const entry = self.data.selectedThread() orelse return; │ │2571 + try self.data.mergePatch(self.session, allocator, entry.id, button_index > 1); │ │2572 + const merged = std.meta.stringToEnum(Status, "merged") orelse return; │ │2573 + const route = listRoute(self.data.identity, merged, "", entry.id) orelse return; │ │2574 + try self.session.navigate(route); │ │2575 + } else unreachable, │ │2576 .remove => try self.submitRemove(allocator), │ │2577 } │ │2578 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯