╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ ui.zig ───────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
2939 if (session.web_port != null) { 2940 var footer = try widget.Footer.init(allocator, session); 2941 errdefer footer.deinit(allocator); 2942 try box.children.put(allocator, footer.getFocus().id, .{ .widget = .{ .footer = footer }, .rect = null, .min_size = .{ .width = null, .height = 1 } }); 2943 } 2944 box.getFocus().child_id = bg_id; 2945 break :blk Widget{ .box = box }; 2946 } else Widget{ .background = try widget.AnsiBackground.init(allocator, page_widget, session) }; 2947 errdefer root.deinit(allocator); 2948 2949 // input-owning views build their TextInputs in init, so reset their 2950 // registrations here 2951 session.text_inputs.clearRetainingCapacity(); 2952 2953 try root.build(allocator, .{ 2954 .min_size = .{ .width = null, .height = 40 }, 2955 .max_size = .{ .width = 100, .height = null }, 2956 }, root.getFocus()); 2957 2958 return root; 2959 } 2960 2961 // native and server-side sessions choose from the embedded collection. WASM 2962 // keeps the art serialized by the server instead. 2963 fn chooseAnsiArtForNavigation(session: *Session) void { 2964 if (comptime ansi_art.art.len == 0) return; 2965 if (session.data.current_page == .not_found) { 2966 session.data.ansi_art = ansi_art.not_found; 2967 return; 2968 } 2969 const io = session.io orelse return; 2970 var random: usize = undefined; 2971 io.random(std.mem.asBytes(&random)); 2972 session.data.ansi_art = ansi_art.art[random % ansi_art.art.len]; 2973 } 2974