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

[feature] fold message body parts #3

Open
pazz opened this issue Aug 12, 2011 · 15 comments
Open

[feature] fold message body parts #3

pazz opened this issue Aug 12, 2011 · 15 comments
Labels

Comments

@pazz
Copy link
Owner

pazz commented Aug 12, 2011

To fold away body parts of messages, define MessageBodyWidget
as urwid.Pile that contains foldable subparts.
Maybe we can subclass urwid.Text to define a FoldableText widget for this.
These should be selectable so that command.ThreadSelect can handle them

pazz added a commit that referenced this issue Aug 13, 2011
replaced dict.has_key(foo) with foo in dict
@ghost
Copy link

ghost commented Feb 18, 2012

Uber-Feature. Would be great to fold all full-quotes.

@pazz
Copy link
Owner Author

pazz commented Feb 18, 2012

hmmyea: i am waiting for s/o to write proper tree widgets in urwid :/ go for it :)

@ghost
Copy link

ghost commented Jan 22, 2014

Is this feature still on the agenda?

@pazz
Copy link
Owner Author

pazz commented Jan 23, 2014

Yes, but afaik, nobody is working on it

@TomasTomecek
Copy link
Contributor

@pazz since you've written foldable tree widgets, this should be doable, right?

@pazz
Copy link
Owner Author

pazz commented Jul 11, 2014

everything is doable.. the problem is how to parse the mail (i.e. the "body" text) into a tree,
not displaying trees. PR's always welcome

@TomasTomecek
Copy link
Contributor

everything is doable..

I don't agree. But I guess we are not here to talk about computer science :)

Right know I really struggle when browsing through long discussions on mailing lists: lots of inline comments, top posters, bottom posters, different quotation styles — I'm assuming this feature will be a real challenge. I'll definitely try to hack something.

@TomasTomecek
Copy link
Contributor

So I spent some time on reading about email quoting practices and here are my thoughts:

  • I think that initially we should do only > quotes (other options are |, %, or whatever char will user choose; initials + quote char (section "Attribution lines" on the wiki page)
  • also we should support folding of top posting (this might be a bit tricky: what if user bottom posts to a Gmail-style quoted message)
  • and bottom posting

@pazz pazz removed the threadview label Dec 10, 2016
@geier
Copy link
Collaborator

geier commented Sep 22, 2017

I've started to experiment a bit with this. For now, my quick hack can find, for top posting, where to fold (only for '>' characters, which is good enough for me), and implements a custom CollapsableTreeWidget.
see https://gist.github.com/geier/1b6920041d3518966fc7f8cb2b55b1d6#file-fold_quoted_replies-py

While I plan to get it into alot, don't get too excited: I have a bad history of hacking on something and than not finishing it up.

What's "left" to do here:

  • fold arbitrarily nested quotes, including bottom posting
  • detect signatures and not fold them
  • integrate in alot (as with my search highlighting path, I'm struggling to fit it in without breaking the highlightable lines)

Anyone wants to collaborate on this?

@geier
Copy link
Collaborator

geier commented Sep 22, 2017

See here as well https://github.com/geier/alot/tree/fold_quoted_replies
current issues:

  • quotes are folded and cannot be unfolded
  • line highlighting is broken

@pazz
Copy link
Owner Author

pazz commented Sep 25, 2017 via email

@geier
Copy link
Collaborator

geier commented Sep 25, 2017

That's what I meant with highlighting is broken. My problem is, when I use TextlinesList, those get folded and only the very first ones get shown. Probably the same problem that makes the it not unfold when used in alot. I just tried to fix it, but I guess I don't grok urwidtrees yet.

2017-09-26-011205_503x69_scrot

2017-09-26-011132_595x592_scrot

I'll carefully look at the examples again later this week.

@pazz
Copy link
Owner Author

pazz commented Sep 26, 2017

thanks. let us know if you need any help with this.

@geier
Copy link
Collaborator

geier commented Sep 26, 2017

So my problem at the moment is, that I have a tree which contains only subtrees, like this:

CollapsibleTree(SimpleTree([(textlineslist1, [(textlineslist2, [(textlineslist3, None)])])]))

The collapsible tree collapses the first TextLinesList and hides all the other ones. I guess this makes sense, because the content has children itself. If I use Piles instead of TextLinesList it works (because there is nothing to collapse), or wrap the TextLinesLists in BlockAdapters (which sureley isn't the way to go). Can I wrap the TextLinesLists somehow? Or do I need to subclass CollapsibleTree?

A minimal example can be found here: https://gist.github.com/geier/740580e2a4193088964a3b4d2c5eb4af

Also, why are you using Trees for the text in the first place (instead of Piles or ListsWalker)? Are they more efficient? Am I missing something?

Thanks for taking a look.

@pazz
Copy link
Owner Author

pazz commented Sep 28, 2017

geier. It's been a while since i looked at this so take this with a gain of salt:
AFAIR, if you stick trees into trees, to display them as you would expect you have to stick the whole thing into a NestedTree. This "relays" the inner structure to the widget Treebox that renders the whole thing. Check out https://github.com/pazz/urwidtrees/blob/master/docs/examples/example5.nested.py

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

No branches or pull requests

4 participants
@geier @pazz @TomasTomecek and others