Skip to content

Commit ad6153e

Browse files
fix(ui): paint snow scene lines by rune column, not byte offset
snowPaintLine used the range index as x offset; in Go that index is the UTF-8 byte position, so multi-byte glyphs (█, ≋, ─) were spaced incorrectly. Track a rune/column counter for correct cell placement. Co-authored-by: Ben Schellenberger <bschellenberger2600@users.noreply.github.com>
1 parent aa87bd4 commit ad6153e

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

internal/ui/snow_scene.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,13 @@ func (rb *RainBackground) snowPaintCell(cells []string, x, y int, ch string, st
287287
}
288288

289289
func (rb *RainBackground) snowPaintLine(cells []string, left, y int, line string, st lipgloss.Style) {
290-
for i, r := range line {
291-
x := left + i
292-
if x < 0 || x >= rb.Width {
293-
continue
290+
col := 0
291+
for _, r := range line {
292+
x := left + col
293+
if x >= 0 && x < rb.Width {
294+
rb.snowPaintCell(cells, x, y, string(r), st)
294295
}
295-
rb.snowPaintCell(cells, x, y, string(r), st)
296+
col++
296297
}
297298
}
298299

0 commit comments

Comments
 (0)