Skip to content

Commit 8d1f754

Browse files
committed
fix: update raw_metar app for improved text wrapping
1 parent 71b480b commit 8d1f754

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

apps/rawmetar/raw_metar.star

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,20 @@ def main(config):
3737
max_line_width = 12
3838
lines_per_page = 4
3939

40-
lines_to_display = [content[i:i + max_line_width] for i in range(0, len(content), max_line_width)]
40+
words = content.split()
41+
lines_to_display = []
42+
current_line = ""
43+
44+
for word in words:
45+
if len(current_line) + len(word) + 1 > max_line_width and current_line:
46+
lines_to_display.append(current_line)
47+
current_line = word
48+
else:
49+
current_line = current_line + (" " + word if current_line else word)
50+
51+
if current_line:
52+
lines_to_display.append(current_line)
53+
4154
pages_to_display = [lines_to_display[i:i + lines_per_page] for i in range(0, len(lines_to_display), lines_per_page)]
4255

4356
frames = []

0 commit comments

Comments
 (0)