1
0
mirror of https://github.com/ihabunek/toot synced 2024-12-23 15:37:47 +01:00

Handle screen position when newline only lines exist

This commit is contained in:
Derek Schmidt 2019-02-28 18:22:54 -07:00 committed by Ivan Habunek
parent 2b3b14c8b7
commit a367f78cbb
No known key found for this signature in database
GPG Key ID: CDBD63C43A30BB95

View File

@ -51,10 +51,15 @@ def size_as_drawn(lines, screen_width):
y = 0
x = 0
for line in lines:
for wrapped_line in wc_wrap(line, screen_width):
x = len(wrapped_line)
wrapped = list(wc_wrap(line, screen_width))
if len(wrapped) > 0:
for wrapped_line in wrapped:
x = len(wrapped_line)
y += 1
else:
x = 0
y += 1
return y - 1, x - 1
return y - 1, x - 1 if x != 0 else 0
def draw_lines(window, lines, start_y, padding, default_color):