╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ ui.zig ───────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
2388 } 2389 box.getFocus().child_id = bg_id; 2390 break :blk Widget{ .box = box }; 2391 } else Widget{ .background = try widget.AnsiBackground.init(allocator, page_widget, session) }; 2392 errdefer root.deinit(allocator); 2393 2394 // input-owning views build their TextInputs in init, so reset their 2395 // registrations here 2396 session.text_inputs.clearRetainingCapacity(); 2397 2398 try root.build(allocator, .{ 2399 .min_size = .{ .width = null, .height = 40 }, 2400 .max_size = .{ .width = 100, .height = null }, 2401 }, root.getFocus()); 2402 2403 return root; 2404 } 2405 2406 // native and server-side sessions choose from the embedded collection. WASM 2407 // keeps the art serialized by the server instead. 2408 fn chooseAnsiArtForNavigation(session: *Session) void { 2409 if (comptime ansi_arts.len == 0) return; 2410 const io = session.io orelse return; 2411 var random: usize = undefined; 2412 io.random(std.mem.asBytes(&random)); 2413 session.data.ansi_art = ansi_arts[random % ansi_arts.len]; 2414 } 2415