╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────╮ │← previous│ ╰──────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │390 }; │ │391 } │ │392 │ │405 - // the url path a files/commits route's stored string (identity + tail) maps │ │406 - // to: "/repo/<string>", or the tail itself when the identity is elided │ │407 - // ("/" at the bare root). │ │408 - fn repoUrlPath(arena: *std.heap.ArenaAllocator, name: []const u8) ![]const u8 { │ │409 - if (identityElided(name)) return if (name.len == 0) "/" else name; │ │410 - return std.fmt.allocPrint(arena.allocator(), repo_segment ++ "{s}", .{name}); │ │411 - } │ │412 - │ │413 - // the url prefix for a repo route's identity: "/repo/<identity>", or "" │ │414 - // when the identity is elided. │ │415 - fn repoUrlPrefix(arena: *std.heap.ArenaAllocator, identity: []const u8) ![]const u8 { │ │416 - if (identity.len == 0) return ""; │ │417 - return std.fmt.allocPrint(arena.allocator(), repo_segment ++ "{s}", .{identity}); │ │418 - } │ │419 - │ │420 - pub fn parent(self: RoutablePage) PageKind { │ │421 - return switch (self) { │ │422 - .home_users, .home_repos, .home_settings, .home_auth => .home, │ │423 - .user_repos, .user_settings, .user_auth => .user, │ │424 - .repo_files, .repo_commits, .repo_refs, .repo_issues, .repo_settings, .repo_auth => .repo,│ │425 - }; │ │426 - } │ │427 - │ │393 pub fn fromUrl(path: []const u8) ?RoutablePage { │ │394 if (std.mem.eql(u8, path, "/")) return default; │ │395 if (path.len < 2 or path[0] != '/') return null; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │433 if (std.mem.eql(u8, path, "/")) return repoFilesRoute("", null, "", "", 0); │ │434 if (path.len < 2 or path[0] != '/') return null; │ │435 return repoSubRoute("", path[1..]); │ │436 + } │ │437 + │ │438 + // the url prefix for a repo route's identity: "/repo/<identity>", or "" │ │439 + // when the identity is elided. │ │440 + fn repoUrlPrefix(arena: *std.heap.ArenaAllocator, identity: []const u8) ![]const u8 { │ │441 + if (identity.len == 0) return ""; │ │442 + return std.fmt.allocPrint(arena.allocator(), repo_segment ++ "{s}", .{identity}); │ │443 } │ │444 │ │445 + pub fn parent(self: RoutablePage) PageKind { │ │446 + return switch (self) { │ │447 + .home_users, .home_repos, .home_settings, .home_auth => .home, │ │448 + .user_repos, .user_settings, .user_auth => .user, │ │449 + .repo_files, .repo_commits, .repo_refs, .repo_issues, .repo_settings, .repo_auth => .repo,│ │450 + }; │ │451 + } │ │452 + │ │453 // the dir a trailing "path:<dir>" names: the raw remainder ("" when │ │454 // absent, null when malformed) │ │455 fn pathValue(rest: []const u8) ?[]const u8 { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │523 .user_repos => |a_u| std.mem.eql(u8, a_u.name.slice(), b.user_repos.name.slice()) and a_u.start == b.user_repos.start, │ │524 .user_settings => |a_name| std.mem.eql(u8, a_name.slice(), b.user_settings.slice()), │ │525 .user_auth => |a_name| std.mem.eql(u8, a_name.slice(), b.user_auth.slice()), │ │546 - .repo_files => |a_name| std.mem.eql(u8, a_name.slice(), b.repo_files.slice()), │ │547 - .repo_commits => |a_name| std.mem.eql(u8, a_name.slice(), b.repo_commits.slice()), │ │526 + .repo_files => |a_f| std.mem.eql(u8, a_f.name.slice(), b.repo_files.name.slice()) and │ │527 + a_f.ref_kind == b.repo_files.ref_kind and │ │528 + std.mem.eql(u8, a_f.ref_value.slice(), b.repo_files.ref_value.slice()) and │ │529 + std.mem.eql(u8, a_f.path.slice(), b.repo_files.path.slice()) and │ │530 + a_f.start == b.repo_files.start, │ │531 + .repo_commits => |a_c| std.mem.eql(u8, a_c.name.slice(), b.repo_commits.name.slice()) and │ │532 + a_c.ref_or_oid == b.repo_commits.ref_or_oid and │ │533 + std.mem.eql(u8, a_c.value.slice(), b.repo_commits.value.slice()) and │ │534 + a_c.start == b.repo_commits.start, │ │535 .repo_refs => |a_r| std.mem.eql(u8, a_r.name.slice(), b.repo_refs.name.slice()) and a_r.kind == b.repo_refs.kind and std.mem.eql(u8, a_r.from.slice(), b.repo_refs.from.slice()),│ │536 .repo_issues => |a_i| std.mem.eql(u8, a_i.name.slice(), b.repo_issues.name.slice()) and │ │537 std.mem.eql(u8, a_i.tag.slice(), b.repo_issues.tag.slice()) and │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │1753 │ │1754 _ = self.arena.reset(.retain_capacity); │ │1755 const aa = self.arena.allocator(); │ │1769 - const path = self.session.data.current_page.urlAlloc(&self.arena) catch return; │ │1756 + const path = self.session.data.current_page.toUrl(&self.arena) catch return; │ │1757 const text = if (self.session.web_port) |port| │ │1758 std.fmt.allocPrint(aa, "http://localhost:{d}{s}", .{ port, path }) catch return│ │1759 else │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯