Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to collapse quoted text? #639

Open
foobacca opened this issue Jul 17, 2013 · 2 comments
Open

Is it possible to collapse quoted text? #639

foobacca opened this issue Jul 17, 2013 · 2 comments

Comments

@foobacca
Copy link
Contributor

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.

@pazz
Copy link
Owner

pazz commented Jul 17, 2013

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

@pinpox
Copy link

pinpox commented Jan 11, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants