From 6efa79778f65fbff6524700702723c6893d8450d Mon Sep 17 00:00:00 2001 From: Gustavo Sousa Date: Wed, 5 Apr 2023 19:05:13 -0300 Subject: [PATCH] commands/thread: Filter out ANSI CSI when replying It is undesirable to have those sequence in the quoted text of a reply message. Remove them. --- alot/commands/thread.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/alot/commands/thread.py b/alot/commands/thread.py index 433ba6a62..ad3839991 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -39,6 +39,7 @@ from ..helper import parse_mailcap_nametemplate from ..helper import split_commandstring from ..utils import argparse as cargparse +from ..utils import ansi from ..widgets.globals import AttachmentWidget MODE = 'thread' @@ -149,11 +150,12 @@ async def apply(self, ui): quotestring = 'Quoting %s (%s)\n' % (name or address, timestamp) mailcontent = quotestring quotehook = settings.get_hook('text_quote') + body_text = ansi.remove_csi(self.message.get_body_text()) if quotehook: - mailcontent += quotehook(self.message.get_body_text()) + mailcontent += quotehook(body_text) else: quote_prefix = settings.get('quote_prefix') - for line in self.message.get_body_text().splitlines(): + for line in body_text.splitlines(): mailcontent += quote_prefix + line + '\n' envelope = Envelope(bodytext=mailcontent, replied=self.message)