diff --git a/subwave_nowplaying.star b/subwave_nowplaying.star index 8efcac2..9cae9f6 100644 --- a/subwave_nowplaying.star +++ b/subwave_nowplaying.star @@ -378,11 +378,41 @@ def main(config): bpm_width = int(len(list(now["bpm"].codepoints())) * 3.9) length_width = int(len(list(now["track_length"].codepoints())) * 3.9) gap = max(0, text_width - bpm_width - length_width) - children.append(render.Row(children = [ - render.Text(now["bpm"], font = "tom-thumb", color = colors["meta"]), - render.Box(width = gap, height = 1), - render.Text(now["track_length"], font = "tom-thumb", color = colors["meta"]), - ])) + + # Wrapped in a Box(width=text_width, height=6) to hard-clip it -- + # every other line in this column is a Marquee, which enforces its + # own declared width, but this Row had nothing constraining it, so + # any estimation error (the 3.9px/char figure is an estimate, not + # an exact measurement -- pixlet has no way to measure rendered + # text width from Starlark) silently overflowed the column instead + # of being clipped, bleeding past the right edge. Also what + # actually supports two-digit minutes/long durations safely: if + # bpm_width + length_width ever exceeds text_width (gap floors at + # 0, so they'd butt up with no space between), this still caps the + # total at text_width rather than spilling out. + # + # height=6 (tom-thumb's own line height) is required, not + # optional: a bare Box(width=...) with no height "expand[s] to + # fill all available space" (pixlet's own docs) -- inside this + # Column's main_align="space_between", that meant the row silently + # grabbed nearly the entire remaining height, squeezing the + # progress bar below it off-screen. Same bug class as the earlier + # time_temp centering fix (a flexible/expanding child stealing + # vertical space it wasn't meant to use), just via Box's own + # implicit expand-when-unconstrained behavior this time instead of + # Row's explicit `expanded=True`. Caught by literally tracing + # pixel colors down a column of the render rather than trusting a + # visual glance -- the row's text was there, just not where + # expected, and the progress bar's color was nowhere in the frame. + children.append(render.Box( + width = text_width, + height = 6, + child = render.Row(children = [ + render.Text(now["bpm"], font = "tom-thumb", color = colors["meta"]), + render.Box(width = gap, height = 1), + render.Text(now["track_length"], font = "tom-thumb", color = colors["meta"]), + ]), + )) if progress != None: children.append(_progress_bar(progress["fraction"], colors, width = text_width, height = 2 * scale))