X-Git-Url: https://mudpy.org/gitweb?a=blobdiff_plain;f=lib%2Fmudpy%2Fmisc.py;h=d8c863ab80032e103882c5163fdb545ba21c73cb;hb=86ca67c3421f3ea64f60f67f4fd43acb662b2cf7;hp=2fe8e6fc851469423482ccc64a9cbeb72187f6d6;hpb=248b078be3a9249a20db8de3860726e8a4ac57ac;p=mudpy.git diff --git a/lib/mudpy/misc.py b/lib/mudpy/misc.py index 2fe8e6f..d8c863a 100644 --- a/lib/mudpy/misc.py +++ b/lib/mudpy/misc.py @@ -800,12 +800,12 @@ class User: # and the ansi escape to return to normal text if not just_prompt and prepend_padding: if not self.output_queue \ - or not self.output_queue[-1].endswith("\r\n"): + or not self.output_queue[-1].endswith(b"\r\n"): output = "$(eol)" + output elif not self.output_queue[-1].endswith( - "\r\n\x1b[0m\r\n" + b"\r\n\x1b[0m\r\n" ) and not self.output_queue[-1].endswith( - "\r\n\r\n" + b"\r\n\r\n" ): output = "$(eol)" + output output += eol + chr(27) + "[0m" @@ -1202,7 +1202,11 @@ def wrap_ansi_text(text, width): escape = False # normalize any potentially composited unicode before we count it - text = unicodedata.normalize("NFKC", text) + # TODO: remove this check after the switch to py3k + try: + text = unicodedata.normalize("NFKC", text) + except TypeError: + text = unicodedata.normalize("NFKC", unicode(text)) # iterate over each character from the begining of the text for each_character in text: