Skip to content

Commit a8d5149

Browse files
#50 make fast_print print all lines
1 parent b8e10de commit a8d5149

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

erika/erika.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def print_ascii(self, text, esc_sequences=False):
173173

174174
def fast_print(self, text):
175175
"""uses reverse printing mode to print even faster"""
176-
lines = text.split("\n")
176+
lines = text.splitlines()
177177
assert len(lines) >= 2, "need at least 2 lines to use fast_printing"
178178
for line_even, line_odd in zip(lines[::2], lines[1::2]):
179179
self.print_ascii(line_even.ljust(len(line_odd)))
@@ -187,6 +187,12 @@ def fast_print(self, text):
187187

188188
self.move_down()
189189

190+
if len(lines) % 2 == 1:
191+
# print last odd line as well
192+
self.print_ascii(lines[-1:])
193+
self.crlf()
194+
195+
190196
def _set_reverse_printing_mode(self, value):
191197
if value:
192198
self._write_byte("8E")

0 commit comments

Comments
 (0)