Skip to content

Commit d398d1e

Browse files
author
shimizukawa
committed
bytes/str/unicode tweaking for py2/3.
1 parent 08f4cf1 commit d398d1e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pyreadline/console/console.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def home(self):
289289

290290
# This pattern should match all characters that change the cursor position differently
291291
# than a normal character.
292-
motion_char_re = re.compile(u'([\n\r\t\010\007])')
292+
motion_char_re = re.compile('([\n\r\t\010\007])'.encode('ascii'))
293293

294294
def write_scrolling(self, text, attr=None):
295295
u'''write text at current cursor position while watching for scrolling.
@@ -309,7 +309,7 @@ def write_scrolling(self, text, attr=None):
309309
w, h = self.size()
310310
scroll = 0 # the result
311311
# split the string into ordinary characters and funny characters
312-
chunks = self.motion_char_re.split(text)
312+
chunks = self.motion_char_re.split(ensure_str(text))
313313
for chunk in chunks:
314314
n = self.write_color(chunk, attr)
315315
if len(chunk) == 1: # the funny characters will be alone

0 commit comments

Comments
 (0)