╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ ui.zig ───────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
3327 if (session.web_port != null) { 3328 var footer = try widget.Footer.init(allocator, session); 3329 errdefer footer.deinit(allocator); 3330 try box.children.put(allocator, footer.getFocus().id, .{ .widget = .{ .footer = footer }, .rect = null, .min_size = .{ .width = null, .height = 1 } }); 3331 } 3332 box.getFocus().child_id = bg_id; 3333 break :blk Widget{ .box = box }; 3334 } else Widget{ .background = try widget.AnsiBackground.init(allocator, page_widget, session) }; 3335 errdefer root.deinit(allocator); 3336 3337 // input-owning views build their TextInputs in init, so reset their 3338 // registrations here 3339 session.text_inputs.clearRetainingCapacity(); 3340 3341 try root.build(allocator, .{ 3342 .min_size = .{ .width = null, .height = 40 }, 3343 .max_size = .{ .width = 100, .height = null }, 3344 }, root.getFocus()); 3345 3346 return root; 3347 } 3348 3349 // native and server-side sessions choose from the embedded collection. WASM 3350 // keeps the art serialized by the server instead. 3351 fn chooseAnsiArtForNavigation(session: *Session) void { 3352 if (comptime ansi_art.art.len == 0) return; 3353 if (session.data.current_page == .not_found) { 3354 session.data.ansi_art = ansi_art.not_found; 3355 return; 3356 } 3357 const io = session.io orelse return; 3358 var random: usize = undefined; 3359 io.random(std.mem.asBytes(&random)); 3360 session.data.ansi_art = ansi_art.art[random % ansi_art.art.len]; 3361 } 3362