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

(cherry picked from commit e0321e2)
[Gustavo: Commit fetched from pazz#1680]
  • Loading branch information
johslarsen authored and guludo committed Sep 19, 2024
1 parent 4d6b24c commit 934b89b
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 934b89b

Please sign in to comment.