# 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 + unichr(27) + "[0m"
+ output += eol + chr(27) + "[0m"
# tack on a prompt if active
if self.state == "active":
# a dict of replacement macros
macros = {
"eol": "\r\n",
- "bld": unichr(27) + "[1m",
- "nrm": unichr(27) + "[0m",
- "blk": unichr(27) + "[30m",
- "blu": unichr(27) + "[34m",
- "cyn": unichr(27) + "[36m",
- "grn": unichr(27) + "[32m",
- "mgt": unichr(27) + "[35m",
- "red": unichr(27) + "[31m",
- "yel": unichr(27) + "[33m",
+ "bld": chr(27) + "[1m",
+ "nrm": chr(27) + "[0m",
+ "blk": chr(27) + "[30m",
+ "blu": chr(27) + "[34m",
+ "cyn": chr(27) + "[36m",
+ "grn": chr(27) + "[32m",
+ "mgt": chr(27) + "[35m",
+ "red": chr(27) + "[31m",
+ "yel": chr(27) + "[33m",
}
# add dynamic macros where possible