Skip to content

Commit

Permalink
bugfix: skip newline after automatically inserted newlines
Browse files Browse the repository at this point in the history
Fixes #32
  • Loading branch information
sknebel committed Jan 4, 2020
1 parent f4e0a3c commit 143e1a2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions erika/tcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,24 @@ def print_to_erika(sanitized_tweet):
erika.crlf()

xpos = 0
for i in range(0, len(sanitized_tweet)):
erika.print_ascii(sanitized_tweet[i])
just_overflow = False
for c in sanitized_tweet:
xpos += 1

if sanitized_tweet[i] == '\n':
if c == '\n':
xpos = 0
if just_overflow:
just_overflow = False
continue

just_overflow = False
erika.print_ascii(c)

if xpos >= ERIKA_MAX_LINE_LENGTH:
erika.crlf()
xpos = 0
just_overflow = True



while True:
Expand Down

0 comments on commit 143e1a2

Please sign in to comment.