Skip to content

Commit

Permalink
Keep ESC control characters in the message body
Browse files Browse the repository at this point in the history
In order to bring back support for ANSI colored HTML renderings etc.

Fixes pazz#1679
  • Loading branch information
johslarsen committed Sep 6, 2024
1 parent 2c32c68 commit e0321e2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions alot/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ def split_commandstring(cmdstring):
def unicode_printable(c):
"""
Checks if the given character is a printable Unicode character, i.e., not a
private/unassigned character and not a control character other than tab or
newline.
private/unassigned character and not a control character other than tab,
newline or ESC (for ANSI escape sequences, e.g. HTML coloring).
"""
if c in ('\n', '\t'):
ESC = '\x1b'
if c in ('\n', '\t', ESC):
return True
return unicodedata.category(c) not in ('Cc', 'Cn', 'Co')

Expand Down

0 comments on commit e0321e2

Please sign in to comment.