╭ changed ────╮ │build.zig.zon│ ╰─────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 3 .version = "0.0.0", │ │ 4 .dependencies = .{ │ │ 5 .xit = .{ │ │ 6 - .url = "git+https://github.com/xit-vcs/xit#bba40effe0123b8f91b174efc5642948b1ae40b4",│ │ 7 - .hash = "xit-0.0.0-Ub3nDFB_UAENpINnJEx0gk0jflswCHmw-Mbnk8x7lipY", │ │ 6 + .url = "git+https://github.com/xit-vcs/xit#8ddcbf5ee63ea5240ff2a25c3ae49426221a5b71",│ │ 7 + .hash = "xit-0.0.0-Ub3nDHMtUQGUVQ_Um2HECyXk_GHaLYOBZSTa-FVmNRJU", │ │ 8 }, │ │ 9 }, │ │10 .paths = .{ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────╮ │609 // inputs. web/wasm form handling looks widgets up here by focus id. │ │610 text_inputs: std.AutoHashMapUnmanaged(usize, *wgt.TextInput(Widget)) = .empty, │ │611 nav_back: bool = false, // set by input (escape) to request the native TUI pop a page; see Nav│ │612 + refresh_requested: bool = false, // set by input (ctrl+r) │ │613 // a requested forward navigation. set this (via navigate) to move to a new │ │614 // page; Nav.sync builds it and then copies it into current_page, clearing │ │615 // this back to null. setting current_page directly only updates the url and │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │779 // request a navigation pop; the host's Nav.sync goes back a page, or│ │780 // quits when there's no history left. │ │781 .escape => session.nav_back = true, │ │782 + .ctrl => |letter| switch (letter) { │ │783 + 'r' => session.refresh_requested = true, │ │784 + else => try root.input(allocator, key, root.getFocus()), │ │785 + }, │ │786 .enter => { │ │787 const root_focus = root.getFocus(); │ │788 if (root_focus.grandchild_id) |gid| { │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────╮ │910 // frees the current page and restores the previous one. when escape is │ │911 // pressed with no history left we switch to the quit tab instead of quitting. │ │912 pub fn sync(self: *Nav, allocator: std.mem.Allocator, session: *Session) !void {│ │913 + // refresh: rebuild the current page in place from a current moment │ │914 + if (session.refresh_requested) { │ │915 + session.refresh_requested = false; │ │916 + if (session.haxy_moment != null) { │ │917 + const arena = try allocator.create(std.heap.ArenaAllocator); │ │918 + arena.* = std.heap.ArenaAllocator.init(allocator); │ │919 + errdefer freeArena(allocator, arena); │ │920 + │ │921 + session.page_arena = arena; │ │922 + │ │923 + const page = try arena.allocator().create(Page); │ │924 + page.* = try Page.init(arena, session, self.route); │ │925 + const new_root = try initRoot(allocator, page, session); │ │926 + │ │927 + self.root.deinit(allocator); │ │928 + freeArena(allocator, self.arena); │ │929 + self.root = new_root; │ │930 + self.arena = arena; │ │931 + } │ │932 + return; │ │933 + } │ │934 + │ │935 if (session.nav_back) { │ │936 session.nav_back = false; │ │937 if (self.history.pop()) |entry| { │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯