Skip to content

Commit 2a786af

Browse files
committed
Adjusted to work in all cases
1 parent c1db755 commit 2a786af

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

adafruit_display_text/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ def chunks(lst, n):
5353
for part in chunks(w, max_chars - 1):
5454
parts.append("{}-".format(part))
5555
the_lines.extend(parts[:-1])
56-
# Remove the last hyphen on the last chunk
5756
the_line = parts[-1][:-1]
5857
continue
5958

6059
if len(the_line + " " + w) <= max_chars:
6160
the_line += " " + w
61+
elif not the_line and len(w) == max_chars:
62+
the_lines.append(w)
6263
else:
6364
the_lines.append(the_line)
6465
the_line = "" + w

0 commit comments

Comments
 (0)