summaryrefslogtreecommitdiff
path: root/urwid/old_str_util.py
diff options
context:
space:
mode:
Diffstat (limited to 'urwid/old_str_util.py')
-rwxr-xr-xurwid/old_str_util.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/urwid/old_str_util.py b/urwid/old_str_util.py
index 83190f5..2c6d1e0 100755
--- a/urwid/old_str_util.py
+++ b/urwid/old_str_util.py
@@ -19,11 +19,12 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Urwid web site: http://excess.org/urwid/
-from __future__ import print_function
+
+from __future__ import division, print_function
import re
-from urwid.compat import bytes, B, ord2
+from urwid.compat import bytes, B, ord2, text_type
SAFE_ASCII_RE = re.compile(u"^[ -~]*$")
SAFE_ASCII_BYTES_RE = re.compile(B("^[ -~]*$"))
@@ -241,7 +242,7 @@ def is_wide_char(text, offs):
text may be unicode or a byte string in the target _byte_encoding
"""
- if isinstance(text, unicode):
+ if isinstance(text, text_type):
o = ord(text[offs])
return get_width(o) == 2
assert isinstance(text, bytes)
@@ -257,7 +258,7 @@ def move_prev_char(text, start_offs, end_offs):
Return the position of the character before end_offs.
"""
assert start_offs < end_offs
- if isinstance(text, unicode):
+ if isinstance(text, text_type):
return end_offs-1
assert isinstance(text, bytes)
if _byte_encoding == "utf8":
@@ -275,7 +276,7 @@ def move_next_char(text, start_offs, end_offs):
Return the position of the character after start_offs.
"""
assert start_offs < end_offs
- if isinstance(text, unicode):
+ if isinstance(text, text_type):
return start_offs+1
assert isinstance(text, bytes)
if _byte_encoding == "utf8":