╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ ui.zig ───────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
2150 .min_size = .{ .width = null, .height = null }, 2151 .max_size = .{ .width = foreground.size.width, .height = foreground.size.height }, 2152 }, root_focus); 2153 2154 var out = try Grid.initFromGrid(allocator, foreground, foreground.size, 0, 0); 2155 errdefer out.deinit(); 2156 2157 if (art.getGrid()) |art_grid| { 2158 const anchor_x = switch (anchor) { 2159 .top_left => 0, 2160 .top_right => foreground.size.width -| art_grid.size.width, 2161 }; 2162 for (0..art_grid.size.height) |y| { 2163 for (0..art_grid.size.width) |x| { 2164 const src = art_grid.cells.items[try art_grid.cells.at(.{ y, x })]; 2165 if (src.rune == null) continue; 2166 const idx = out.cells.at(.{ y, anchor_x + x }) catch continue; 2167 const dst = &out.cells.items[idx]; 2168 // composite the dimmed art behind every cell so it shows 2169 // through the whole UI: a blank cell becomes the art, while a 2170 // cell with a glyph keeps the glyph but takes the dimmed art as 2171 // its background (replacing whatever background it had, which 2172 // would otherwise obscure the art). 2173 if (cellIsBlank(dst.*)) { 2174 dst.* = src; 2175 dst.style.fg = sgrSafe(dimColor(dst.style.fg)); 2176 dst.style.bg = sgrSafe(dimColor(dst.style.bg)); 2177 } else { 2178 dst.style.bg = sgrSafe(dimColor(src.style.bg orelse src.style.fg)); 2179 } 2180 } 2181 } 2182 } 2183 return out; 2184 } 2185 }; 2186