╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │404 pub const RepoUndoRoute = struct { │ │405 name: Array(repo_identity_max_len), │ │406 index: ?u64 = null, │ │407 + // the clear-history confirmation page, which has no selected entry│ │408 + clear: bool = false, │ │409 }; │ │410 │ │411 pub fn repoUndoRoute(identity: []const u8, index: ?u64) ?RoutablePage {│ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │412 return .{ .repo_undo = .{ .name = Array(repo_identity_max_len).from(identity) orelse return null, .index = index } };│ │413 + } │ │414 + │ │415 + pub fn repoUndoClearRoute(identity: []const u8) ?RoutablePage { │ │416 + return .{ .repo_undo = .{ .name = Array(repo_identity_max_len).from(identity) orelse return null, .clear = true } }; │ │417 } │ │418 │ │419 pub const RepoEventsRoute = struct { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1164 }, │ │1165 .repo_undo => |u| blk: { │ │1166 const prefix = try repoUrlPrefix(arena, u.name.slice()); │ │1161 - break :blk if (u.index) |index| try std.fmt.allocPrint(arena.allocator(), "{s}/undo/{d}", .{ prefix, index }) else try std.fmt.allocPrint(arena.allocator(), "{s}/undo", .{prefix});│ │1167 + break :blk if (u.clear) │ │1168 + try std.fmt.allocPrint(arena.allocator(), "{s}/undo/clear", .{prefix}) │ │1169 + else if (u.index) |index| │ │1170 + try std.fmt.allocPrint(arena.allocator(), "{s}/undo/{d}", .{ prefix, index }) │ │1171 + else │ │1172 + try std.fmt.allocPrint(arena.allocator(), "{s}/undo", .{prefix}); │ │1173 }, │ │1174 .repo_events => |e| blk: { │ │1175 const prefix = try repoUrlPrefix(arena, e.name.slice()); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1566 return null; │ │1567 } │ │1568 if (std.mem.eql(u8, tab, "undo")) { │ │1558 - const index = if (segments.next()) |word| std.fmt.parseInt(u64, word, 10) catch return null else null;│ │1559 - return if (segments.next() == null) repoUndoRoute(pair, index) else null; │ │1569 + const word = segments.next(); │ │1570 + if (segments.next() != null) return null; │ │1571 + const value = word orelse return repoUndoRoute(pair, null); │ │1572 + if (std.mem.eql(u8, value, "clear")) return repoUndoClearRoute(pair); │ │1573 + return repoUndoRoute(pair, std.fmt.parseInt(u64, value, 10) catch return null); │ │1574 } │ │1575 if (std.mem.eql(u8, tab, "events")) { │ │1576 const word = params.scanTail(&segments) catch return null; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1712 a_p.view == b.repo_patches.view and │ │1713 a_p.comments_start == b.repo_patches.comments_start and │ │1714 std.mem.eql(u8, a_p.comment.slice(), b.repo_patches.comment.slice()), │ │1701 - .repo_undo => |a_u| std.mem.eql(u8, a_u.name.slice(), b.repo_undo.name.slice()) and a_u.index == b.repo_undo.index,│ │1715 + .repo_undo => |a_u| std.mem.eql(u8, a_u.name.slice(), b.repo_undo.name.slice()) and │ │1716 + a_u.index == b.repo_undo.index and │ │1717 + a_u.clear == b.repo_undo.clear, │ │1718 .repo_events => |a_e| std.mem.eql(u8, a_e.name.slice(), b.repo_events.name.slice()) and │ │1719 a_e.view == b.repo_events.view and │ │1720 a_e.moment == b.repo_events.moment and │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯