╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ ui.zig ───────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
3034 if (session.web_port != null) { 3035 var footer = try widget.Footer.init(allocator, session); 3036 errdefer footer.deinit(allocator); 3037 try box.children.put(allocator, footer.getFocus().id, .{ .widget = .{ .footer = footer }, .rect = null, .min_size = .{ .width = null, .height = 1 } }); 3038 } 3039 box.getFocus().child_id = bg_id; 3040 break :blk Widget{ .box = box }; 3041 } else Widget{ .background = try widget.AnsiBackground.init(allocator, page_widget, session) }; 3042 errdefer root.deinit(allocator); 3043 3044 // input-owning views build their TextInputs in init, so reset their 3045 // registrations here 3046 session.text_inputs.clearRetainingCapacity(); 3047 3048 try root.build(allocator, .{ 3049 .min_size = .{ .width = null, .height = 40 }, 3050 .max_size = .{ .width = 100, .height = null }, 3051 }, root.getFocus()); 3052 3053 return root; 3054 } 3055 3056 // native and server-side sessions choose from the embedded collection. WASM 3057 // keeps the art serialized by the server instead. 3058 fn chooseAnsiArtForNavigation(session: *Session) void { 3059 if (comptime ansi_art.art.len == 0) return; 3060 if (session.data.current_page == .not_found) { 3061 session.data.ansi_art = ansi_art.not_found; 3062 return; 3063 } 3064 const io = session.io orelse return; 3065 var random: usize = undefined; 3066 io.random(std.mem.asBytes(&random)); 3067 session.data.ansi_art = ansi_art.art[random % ansi_art.art.len]; 3068 } 3069