Skip to content

Commit

Permalink
commands/thread: Filter out ANSI CSI when replying
Browse files Browse the repository at this point in the history
It is undesirable to have those sequence in the quoted text of a reply
message. Remove them.
  • Loading branch information
guludo authored and pazz committed Apr 12, 2023
1 parent f8e255d commit 6f3c3f0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions alot/commands/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6f3c3f0

Please sign in to comment.