summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-03-01 15:10:57 +0100
committerAnton Khirnov <anton@khirnov.net>2021-03-01 15:10:57 +0100
commit0ec4ea39648f5ff74602c67cfb6e18334a15da27 (patch)
treeccd97d332cd9ebac7a9f49b188cfeae936875c66
parenta39f655d04bca15de0cfd2ffe6fc0dc76e9f72d1 (diff)
settings/manager: remove newlines from headers during sanitization
-rw-r--r--alot/settings/manager.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/alot/settings/manager.py b/alot/settings/manager.py
index a1e2ab6d..af8718e0 100644
--- a/alot/settings/manager.py
+++ b/alot/settings/manager.py
@@ -598,7 +598,7 @@ class SettingsManager:
rep = _pretty_datetime(d)
return rep
- def _make_trans_table(self, tab_width):
+ def _make_trans_table(self, tab_width, replace_newline):
table = {}
# remove C1 control codes
@@ -616,8 +616,11 @@ class SettingsManager:
# delete LF
table[ord('\r')] = None
- # handle CR normally
- del table[ord('\n')]
+ if replace_newline:
+ table[ord('\n')] = ' '
+ else:
+ # handle CR normally
+ del table[ord('\n')]
# expand tabs
table[ord('\t')] = ' ' * tab_width
@@ -626,7 +629,7 @@ class SettingsManager:
@cached_property
def sanitize_text_table(self):
- return self._make_trans_table(self.get('tabwidth'))
+ return self._make_trans_table(self.get('tabwidth'), False)
@cached_property
def sanitize_header_table(self):
- return self._make_trans_table(1)
+ return self._make_trans_table(1, True)