alot icon indicating copy to clipboard operation
alot copied to clipboard

Is it possible to collapse quoted text?

Open foobacca opened this issue 12 years ago • 2 comments

I know I can collapse whole messages and they are shortcuts to move from message to message, but sometimes I would prefer to be able to collapse the quoted text.

Is there some way to do this? I've spent quite a bit of time reading the (great, thorough) docs and haven't found anything.

Assuming there isn't I'm up for having a go at doing this, so any pointers as to where in the code would be appropriate to start would be appreciated.

foobacca avatar Jul 17 '13 16:07 foobacca

This is not possible with the current implementation unfortunately.

I think one way to start making this possible is to somehow parse a "body string" of a mail into a tree (of strings) and then use a derived widget-tree instead of the TextlinesList in alot.widgets.thread.MessageTree

You might want to play around a bit with the urwidtrees library I wrote (which is in alot/foreign/urwidtrees/, including example code).

As the MessageTree class already derives from CollapsibleTree, it can already collapse subtrees. So having the body text not as a list of lines but as a tree (alot.foreignurwidtrees.tree.Tree that is), means you can use the collapse/expand methods on it (and on the NestedTree accessible via ui.current_buffer.self._nested_tree in thread mode). Then, one would only need commands to expand/collapse the subtree under the focus (use ThreadBuffer.get_focus() and hand it to NestedTree.expand...)

So, a good start would be to parse the return value of accumolate_body (or similar), into a urwidtrees.tree.Tree of alot.widgets.thread.FocusableText widgets.

In the long run, It'd be great not to hardcode this but have some sort of expandable parser that translates a email object into a Tree. This could in theory deal with sub-parts in the messages MIME-tree individually (see the partial solutions in the "mimeparsing" branches). For instance, it could call external text-renderer for attachments, or even for text-parts, pipe them through some external tool or hook that turns it into a text enriched with ascii escape codes for colours etc (see issues #272, #612).

I hope this helps more than it is confusing.. Have fun, /p

pazz avatar Jul 17 '13 19:07 pazz

+1 for this feature. Reading long threads is extremly confusing with a lot of replies that all quote the past mails.

pinpox avatar Jan 11 '16 15:01 pinpox