╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ ui.zig ───────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
2488 break :bg_blk id; 2489 }; 2490 { 2491 var footer = try widget.Footer.init(allocator, session); 2492 errdefer footer.deinit(allocator); 2493 try box.children.put(allocator, footer.getFocus().id, .{ .widget = .{ .footer = footer }, .rect = null, .min_size = .{ .width = null, .height = 1 } }); 2494 } 2495 box.getFocus().child_id = bg_id; 2496 break :blk Widget{ .box = box }; 2497 } else Widget{ .background = try widget.AnsiBackground.init(allocator, page_widget, session) }; 2498 errdefer root.deinit(allocator); 2499 2500 // input-owning views build their TextInputs in init, so reset their 2501 // registrations here 2502 session.text_inputs.clearRetainingCapacity(); 2503 2504 try root.build(allocator, .{ 2505 .min_size = .{ .width = null, .height = 40 }, 2506 .max_size = .{ .width = 100, .height = null }, 2507 }, root.getFocus()); 2508 2509 return root; 2510 } 2511 2512 // native and server-side sessions choose from the embedded collection. WASM 2513 // keeps the art serialized by the server instead. 2514 fn chooseAnsiArtForNavigation(session: *Session) void { 2515 if (comptime ansi_arts.len == 0) return; 2516 const io = session.io orelse return; 2517 var random: usize = undefined; 2518 io.random(std.mem.asBytes(&random)); 2519 session.data.ansi_art = ansi_arts[random % ansi_arts.len]; 2520 } 2521