╭ changed ───────────╮ │src/ui/Repo/Undo.zig│ ╰────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────────╮ │44 items: []const Item = &.{}, │ │45 next: ?u64 = null, │ │46 failure: ?[]const u8 = null, │ │47 -can_undo: bool = false, │ │47 +handle: ui.RepoHandle, │ │48 // the clear-history confirmation stands in for the list│ │49 clear: bool = false, │ │50 │ ╰────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │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 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯