╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1796 - .user_repos => |bb| std.mem.eql(u8, aa.name.slice(), bb.name.slice()) and aa.start != bb.start,│ │1834 + .user_repos => |bb| std.mem.eql(u8, aa.name.slice(), bb.name.slice()) and !a.eql(b), │ │1835 else => false, │ │1836 }, │ │1837 .user_forks => |aa| switch (b) { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────╮ │1843 } │ │1844 │ │1845 // true when `a` and `b` are the same home list tab paginated to a different│ │1808 - // window. switching tabs is in-page, so only a changed `start` on the same │ │1809 - // tab navigates. │ │1846 + // window or search. switching tabs is in-page, so only a changed `start` or│ │1847 + // search on the same tab navigates. │ │1848 pub fn homePageChanged(a: RoutablePage, b: RoutablePage) bool { │ │1849 return switch (a) { │ │1812 - .home_users => |aa| switch (b) { │ │1813 - .home_users => |bb| aa != bb, │ │1850 + .home_users => switch (b) { │ │1851 + .home_users => !a.eql(b), │ │1852 else => false, │ │1853 }, │ │1854 else => false, │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────╮ │src/ui/Home.zig│ ╰───────────────╯ ╭─────────────────────────────────────────────────────╮ │30 arena: *std.heap.ArenaAllocator, │ │31 session: *ui.Session, │ │32 haxy_moment: evt.AdminDB.HashMap(.read_only),│ │33 - // pagination window start for the users tab │ │34 - users_start: usize, │ │33 + // the users tab's window and search │ │34 + users_route: ui.RoutablePage.HomeUsersRoute, │ │35 ) !Self { │ │36 const about = try About.init(arena, session);│ │37 return .{ │ ╰─────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────╮ │38 .header = try Header.init(arena, about.title), │ │39 .about = about, │ │40 - .users = try Users.init(arena, haxy_moment, users_start),│ │40 + .users = try Users.init(arena, haxy_moment, users_route),│ │41 .settings = Settings.init(), │ │42 .auth = Auth.init(), │ │43 .quit = Quit.init(), │ ╰─────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │73 } │ │74 │ │75 { │ │76 - var users_view = try Users.View.init(allocator, &data.users, !session.is_terminal); │ │76 + var users_view = try Users.View.init(allocator, &data.users, session); │ │77 errdefer users_view.deinit(allocator); │ │78 try stack.children.put(allocator, users_view.getFocus().id, .{ .home_users = users_view });│ │79 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │104 var self = View{ │ │105 .box = box, │ │106 }; │ │107 - self.getFocus().child_id = box.children.keys()[header_index]; │ │107 + // search results open in the tab's own search box │ │108 + self.getFocus().child_id = box.children.keys()[if (data.users.search != null) stack_index else header_index];│ │109 return self; │ │110 } │ │111 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │125 } │ │126 │ │127 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void {│ │128 + const stack = &self.box.children.values()[stack_index].widget.stack; │ │129 if (self.getFocus().child_id) |child_id| { │ │130 if (self.box.children.getIndex(child_id)) |current_index| { │ │131 const child = &self.box.children.values()[current_index].widget; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │154 .down => { │ │155 switch (child.*) { │ │156 .home_header => { │ │157 + if (stack.getSelected()) |selected_widget| switch (selected_widget.*) {│ │158 + .home_users => |*v| return v.focusHeader(root_focus), │ │159 + else => {}, │ │160 + }; │ │161 index = stack_index; │ │162 }, │ │163 .stack => { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─────────────╮ │src/ui/Home/Header.zig│ ╰──────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │90 // link (rather than position) keeps this robust to tab changes. │ │91 const current_tag = std.meta.activeTag(session.data.current_page); │ │92 const about_link = try ui.inPageTabLink(session, .home_about, current_tag == .home_about); │ │93 - const users_link = try ui.inPageTabLink(session, .{ .home_users = 0 }, current_tag == .home_users); │ │93 + const users_link = try ui.inPageTabLink(session, .{ .home_users = .{} }, current_tag == .home_users);│ │94 const settings_link = try ui.inPageTabLink(session, .home_settings, current_tag == .home_settings); │ │95 const auth_link = try ui.inPageTabLink(session, .home_auth, current_tag == .home_auth); │ │96 const current_link: []const u8 = switch (current_tag) { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ────────────╮ │src/ui/Home/Users.zig│ ╰─────────────────────╯ ╭────────────────────────────────────────────────────────────────╮ │ 9 const Key = xitui.input.Key; │ │10 const Grid = xitui.grid.Grid; │ │11 const Focus = xitui.focus.Focus; │ │12 +const inp = @import("../input.zig"); │ │13 │ │14 pub const page_size = 20; // how many users one window shows│ │15 │ ╰────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯