╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ───────────╮ │src/ui/Repo/Undo.zig│ ╰────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │51 -pub fn init(comptime opts: rp.RepoOpts(.xit), arena: *std.heap.ArenaAllocator, repo: *rp.Repo(.xit, opts), haxy_moment: ?evt.AdminDB.HashMap(.read_only), identity: []const u8, selected: ?u64) !Self { │ │51 +pub fn init(comptime opts: rp.RepoOpts(.xit), arena: *std.heap.ArenaAllocator, repo: *rp.Repo(.xit, opts), haxy_moment: ?evt.AdminDB.HashMap(.read_only), identity: []const u8, selected: ?u64, handle: ui.RepoHandle) !Self {│ │52 const aa = arena.allocator(); │ │53 const DB = rp.Repo(.xit, opts).DB; │ │54 const history = try DB.ArrayList(.read_only).init(repo.core.db.rootCursor().readOnly()); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │101 .undone = row_undone, │ │102 }); │ │103 } │ │104 - return .{ .identity = try aa.dupe(u8, identity), .count = count, .items = items.items, .next = if (remaining > 0) remaining - 1 else null }; │ │104 + return .{ .identity = try aa.dupe(u8, identity), .handle = handle, .count = count, .items = items.items, .next = if (remaining > 0) remaining - 1 else null };│ │105 } │ │106 │ │107 const Detail = struct { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │476 var button = try wgt.TextBox.init(allocator, "clear undo history", .{ .border_style = .single, .round_corners = true, .wrap_kind = .none });│ │477 errdefer button.deinit(allocator); │ │478 button.getFocus().mode = .all; │ │479 - button.getFocus().kind = if (data.can_undo) .{ .custom = "submit" } else .text_box; │ │479 + button.getFocus().kind = if (data.handle.canUndo()) .{ .custom = "submit" } else .text_box; │ │480 try box.children.put(allocator, button.getFocus().id, .{ .widget = .{ .text_box = button }, .rect = null, .min_size = null }); │ │481 box.getFocus().child_id = button.getFocus().id; │ │482 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────╮ │548 entry.value.widget.deinit(allocator); │ │549 } │ │550 const item = self.data.items[index]; │ │551 - const enabled = self.data.can_undo and item.index > 0; │ │551 + const enabled = self.data.handle.canUndo() and item.index > 0; │ │552 │ │553 // the fixed rows are filled first, since adding the ones below│ │554 // invalidates every pointer into the box │ ╰────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │617 if (self.detailActive()) { │ │618 const details = &self.detailScroll().child.box; │ │619 if (self.selected()) |index| { │ │620 - if (activated(root_focus, details.children.keys()[0], key) and self.data.can_undo and self.data.items[index].index > 0) { │ │620 + if (activated(root_focus, details.children.keys()[0], key) and self.data.handle.canUndo() and self.data.items[index].index > 0) { │ │621 self.requestUndo(ui.RoutablePage.repoUndoRoute(self.data.identity, self.data.items[index].index) orelse return error.RouteTooLong);│ │622 return; │ │623 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │637 fn clearInput(self: *View, key: Key, root_focus: *Focus) !void { │ │638 const center = &self.box.children.values()[content_index].widget.center; │ │639 const button_id = center.child.box.getFocus().child_id orelse return; │ │640 - if (!activated(root_focus, button_id, key) or !self.data.can_undo) return; │ │640 + if (!activated(root_focus, button_id, key) or !self.data.handle.canUndo()) return; │ │641 self.requestUndo(ui.RoutablePage.repoUndoClearRoute(self.data.identity) orelse return error.RouteTooLong);│ │642 } │ │643 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ────────╮ │src/ui/widget.zig│ ╰─────────────────╯ ╭─────────────────────────────────────────────────────╮ │1018 pub fn init( │ │1019 allocator: std.mem.Allocator, │ │1020 session: *ui.Session, │ │1021 - location: ui.RoutablePage.RepoLocation,│ │1021 + handle: ui.RepoHandle, │ │1022 label: []const u8, │ │1023 name: []const u8, │ │1024 text: ?[]const u8, │ ╰─────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────╮ │1043 } │ │1044 │ │1045 if (session.data.host_kind == .server) { │ │1046 - if (try CopyableText.initClone(allocator, session, location)) |value| {│ │1046 + if (try CopyableText.initClone(allocator, session, handle)) |value| { │ │1047 var clone_url = value; │ │1048 errdefer clone_url.deinit(allocator); │ │1049 const min_width = clone_url.minWidth(); │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1782 choices: []Choice, │ │1783 selected: usize = 0, │ │1784 │ │1785 - pub fn init(allocator: std.mem.Allocator, session: *ui.Session, choices: []const Choice) !CopyableText { │ │1785 + pub fn init(allocator: std.mem.Allocator, session: *ui.Session, choices: []const Choice, initial: usize) !CopyableText {│ │1786 if (choices.len == 0) return error.MissingCopyableText; │ │1787 │ │1788 const owned_choices = try allocator.dupe(Choice, choices); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────╮ │1801 var text_input = try wgt.TextInput.init(allocator, .{│ │1802 .border_style = .single, │ │1803 .round_corners = true, │ │1804 - .label = choices[0].label, │ │1805 - .bottom_label = choices[0].bottom_label, │ │1804 + .label = choices[initial].label, │ │1805 + .bottom_label = choices[initial].bottom_label, │ │1806 .read_only = true, │ │1807 .render_content = session.is_terminal, │ │1808 .visible_width = null, │ ╰───────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯