From 934b89b893533b7acdb873d87f1c393cec6a8f69 Mon Sep 17 00:00:00 2001 From: Johannes Larsen Date: Tue, 3 Sep 2024 17:55:29 +0200 Subject: [PATCH] Keep ESC control characters in the message body In order to bring back support for ANSI colored HTML renderings etc. Fixes #1679 (cherry picked from commit e0321e22a83ca2d2ddad327fe71c79bbf8d1b598) [Gustavo: Commit fetched from https://github.com/pazz/alot/pull/1680] --- alot/helper.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/alot/helper.py b/alot/helper.py index d5ac9efe7..6236c7b44 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -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')