diff --git a/subwave_nowplaying.star b/subwave_nowplaying.star index 11df999..002a57e 100644 --- a/subwave_nowplaying.star +++ b/subwave_nowplaying.star @@ -233,8 +233,23 @@ def main(config): # 15 chars keeps a real margin against overflowing into the art # column instead of relying on a 1px coincidence. Always Marquee at # 1x, where the available width is tighter regardless of length. - time_temp_fits = scale == 2 and len(now["time_temp"]) <= 15 - time_temp_line = time_temp_text if time_temp_fits else render.Marquee(width = text_width, child = time_temp_text) + # + # Counted via codepoints, not a bare len(): Starlark's len() on a + # string counts UTF-8 *bytes*, and this string almost always has at + # least one multi-byte character (the \xb7 separator, \xb0 in the temp, + # if any) -- confirmed len() reports 16 for a real 14-character + # string here, which silently sent every normal-length string down + # the Marquee branch instead of the intended centered-static-text one + # (visually: text appeared "stuck" left-aligned with no error, since + # Marquee just shows already-fitting content statically rather than + # scrolling it -- easy to mistake for "the centering didn't work"). + time_temp_char_count = len(list(now["time_temp"].codepoints())) + time_temp_fits = scale == 2 and time_temp_char_count <= 15 + time_temp_line = ( + render.Box(width = text_width, child = render.Row(main_align = "center", expanded = True, children = [time_temp_text])) + if time_temp_fits else + render.Marquee(width = text_width, child = time_temp_text) + ) top_lines = [ render.Marquee(width = text_width, child = render.Text(now["title"], font = "tb-8", color = colors["text"])),