@@ -184,12 +184,7 @@ def set_cursor_pos(self, row, col):
184
184
def print (self , string ):
185
185
"""
186
186
Write the specified unicode string to the display.
187
-
188
- To control multiline behavior, use newline (``\\ n``) and carriage
189
- return (``\\ r``) characters. Newline moves to the next row without
190
- resetting the column to the left or right side. Carriage return
191
- moves to the left or right side of the current row.
192
-
187
+ A newline ('\n ') will advance to the left side of the next row.
193
188
Lines that are too long automatically continue on next line.
194
189
195
190
Only characters with an ``ord()`` value between 0 and 255 are currently
@@ -198,11 +193,8 @@ def print(self, string):
198
193
"""
199
194
for char in string :
200
195
if char == '\n ' :
201
- # Advance to next row, at same column position
202
- self .set_cursor_pos ((self ._row + 1 ) % self .num_rows , self ._col )
203
- elif char == '\r ' :
204
- # Return to left side of current row.
205
- self .set_cursor_pos (self ._row , 0 )
196
+ # Advance to next row, at left side. Wrap around to top row if at bottom.
197
+ self .set_cursor_pos ((self ._row + 1 ) % self .num_rows , 0 )
206
198
else :
207
199
self .write (ord (char ))
208
200
@@ -290,9 +282,8 @@ def write(self, value):
290
282
self ._col += 1
291
283
else :
292
284
# At end of line: go to left side next row. Wrap around to first row if on last row.
293
- self .set_cursor_pos ((self ._row + 1 ) % self .num_rows , 0 )
285
+ self ._row = (self ._row + 1 ) % self .num_rows
286
+ self ._col = 0
294
287
295
- # Internal increment may put cursor at wrong place. Reset to where we
296
- # want the next character to go.
297
288
self .set_cursor_pos (self ._row , self ._col )
298
289
0 commit comments