Closed pacien closed 4 years ago
I guess a better solution would be to fix this parsing method. Could you post the stack trace here? I forgot how to quickly add your buggy email...
I agree it would be better to fix the parser too so that correctly formatted emails are well-coloured.
But it is always possible to receive badly formatted emails with truely invalid ANSI escape codes that will crash the parser anyway. In this case it is still nice to be able to see the plaintext/unparsed version of those messages.
The stacktrace is in the issue https://github.com/pazz/alot/issues/1493:
ERROR:ui:Traceback (most recent call last):
File "/nix/store/3wf27s3sc21fbh9va1fp1iggqvi2mncz-python3.7-alot-0.8/lib/python3.7/site-packages/alot/ui.py", line 718, in apply_command
cmd.apply(self)
File "/nix/store/3wf27s3sc21fbh9va1fp1iggqvi2mncz-python3.7-alot-0.8/lib/python3.7/site-packages/alot/commands/globals.py", line 611, in apply
ui.dbman.flush()
File "/nix/store/3wf27s3sc21fbh9va1fp1iggqvi2mncz-python3.7-alot-0.8/lib/python3.7/site-packages/alot/db/manager.py", line 141, in flush
afterwards()
File "/nix/store/3wf27s3sc21fbh9va1fp1iggqvi2mncz-python3.7-alot-0.8/lib/python3.7/site-packages/alot/db/message.py", line 223, in myafterwards
afterwards()
File "/nix/store/3wf27s3sc21fbh9va1fp1iggqvi2mncz-python3.7-alot-0.8/lib/python3.7/site-packages/alot/commands/thread.py", line 1112, in refresh_widgets
mt.refresh()
File "/nix/store/3wf27s3sc21fbh9va1fp1iggqvi2mncz-python3.7-alot-0.8/lib/python3.7/site-packages/alot/widgets/thread.py", line 175, in refresh
self.reassemble()
File "/nix/store/3wf27s3sc21fbh9va1fp1iggqvi2mncz-python3.7-alot-0.8/lib/python3.7/site-packages/alot/widgets/thread.py", line 171, in reassemble
self._maintree._treelist = self._assemble_structure()
File "/nix/store/3wf27s3sc21fbh9va1fp1iggqvi2mncz-python3.7-alot-0.8/lib/python3.7/site-packages/alot/widgets/thread.py", line 213, in _assemble_structure
bodytree = self._get_body()
File "/nix/store/3wf27s3sc21fbh9va1fp1iggqvi2mncz-python3.7-alot-0.8/lib/python3.7/site-packages/alot/widgets/thread.py", line 252, in _get_body
self._bodytree = TextlinesList(bodytxt, att, att_focus)
File "/nix/store/3wf27s3sc21fbh9va1fp1iggqvi2mncz-python3.7-alot-0.8/lib/python3.7/site-packages/alot/widgets/thread.py", line 90, in __init__
ansi_background), None))
File "/nix/store/3wf27s3sc21fbh9va1fp1iggqvi2mncz-python3.7-alot-0.8/lib/python3.7/site-packages/alot/widgets/ansi.py", line 18, in __init__
ansi_background)
File "/nix/store/3wf27s3sc21fbh9va1fp1iggqvi2mncz-python3.7-alot-0.8/lib/python3.7/site-packages/alot/widgets/ansi.py", line 72, in parse_escapes_to_urwid
esc_code, esc_substr = part.split('m', 1)
ValueError: not enough values to unpack (expected 2, got 1)
I don't know whether there is a simpler way to open .eml files in alot, but I simply copy them to my maildir.
@pacien try my new branch on your email please. I've re-written the parser and it should be much more selective and careful now.
out of interest: what do you use to create ANSI codes? I only ever found elinks
and it really isn't all that useful for those emails I receive..
@pacien try my new branch on your email please. I've re-written the parser and it should be much more selective and careful now.
See my comment: https://github.com/pazz/alot/pull/1503#issuecomment-625465454. I'm closing this in favour of this new patch.
out of interest: what do you use to create ANSI codes? I only ever found elinks and it really isn't all that useful for those emails I receive..
The ANSI codes in the problematic example were generated by the output of a command that ran on a CI service and transmitted as is.
Otherwise, I'm trying to use colordiff to add some colours to inline patches that I receive, but adding a mailcap entry like below doesn't seem to have any effect.
.mailcap:
text/plain; cat %s | colordiff; copiousoutput
Instead of crashing and leaving the user with a blank screen when trying to open some messages containing non-handled escape codes.
GitHub: relates to #1493