╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ ui.zig ───────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
3379 var footer = try widget.Footer.init(allocator, session); 3380 errdefer footer.deinit(allocator); 3381 try box.children.put(allocator, footer.getFocus().id, .{ .widget = .{ .footer = footer }, .rect = null, .min_size = .{ .width = null, .height = 1 } }); 3382 } 3383 box.getFocus().child_id = bg_id; 3384 break :blk Widget{ .box = box }; 3385 } else Widget{ .background = try widget.AnsiBackground.init(allocator, page_widget, session) }; 3386 errdefer root.deinit(allocator); 3387 3388 // input-owning views build their TextInputs in init, so reset their 3389 // registrations here 3390 session.text_inputs.clearRetainingCapacity(); 3391 3392 try root.build(allocator, .{ 3393 .min_size = .{ .width = null, .height = 40 }, 3394 .max_size = .{ .width = 100, .height = null }, 3395 }, root.getFocus()); 3396 3397 return root; 3398 } 3399 3400 // native and server-side sessions choose from the embedded collection. WASM 3401 // keeps the art serialized by the server instead. 3402 fn chooseAnsiArtForNavigation(session: *Session) void { 3403 if (comptime ansi_art.art.len == 0) return; 3404 if (session.data.current_page == .not_found) { 3405 session.data.ansi_art = ansi_art.not_found; 3406 return; 3407 } 3408 const io = session.io orelse return; 3409 var random: usize = undefined; 3410 io.random(std.mem.asBytes(&random)); 3411 session.data.ansi_art = ansi_art.art[random % ansi_art.art.len]; 3412 } 3413