Subject: [sup-talk] Toggle expand/collapse of a message in threadview

From: [email-masked] (Christopher Bertels)
Date: Thu, 04 Jun 2009 23:28:58 +0200

Hi!
I've been wondering:
Is there a way to expand/collsape the current message I'm reading when in the
middle of it?
I know I can press ENTER to toggle it when I'm hovering the message's header,
but is it possible when I'm in the middle of a message?
When reading long threads with long messages, this would really be handy, as
for now I always have to go up or toggle all messages and
work my way through a thread like that.
It would be nice if I could simply press a key to toggle the current message
I'm looking at (where the current highlighted line belongs to).

Maybe I'm blind and simply haven't found this feature? Can't find it in the
help menu.

Thanks,
Christopher.
-- 
================================
Christopher Bertels
http://www.adztec-independent.de

---

From: [email-masked] (William Morgan)
Date: Thu, 04 Jun 2009 20:38:23 -0700

Reformatted excerpts from Christopher Bertels's message of 2009-06-04:
> Is there a way to expand/collsape the current message I'm reading when
> in the middle of it?

Good idea. I've changed this in git. Pressing enter on a text region now
collapses the message. Behavior of enter on quotes, signatures,
attachments, etc. is unchanged.

Also, collapsing a message will make the cursor jump to the next open
message. So you should be able to scan rapidly through a thread one
message at a time by hitting enter to collapse it or 'n' to leave open.
(And then 'p' and 'n' to review all open messages.)
-- 
William <wmorgan-sup at masanjin.net>

---

From: [email-masked] (Christopher Bertels)
Date: Fri, 05 Jun 2009 13:02:13 +0200

Oh cool!
Thanks, works great and exactly what I wanted! :)

---

From: [email-masked] (Christopher Bertels)
Date: Fri, 05 Jun 2009 13:09:34 +0200

Actually, now that I've been using it a little more, I think it would be nicer
that when pressing enter on a collapsed message, the cursor would stay at the 
header of that expanded message instead of moving to the next message header.
Right now, it's always moving to the next message, even when expanding a collapsed
message to read it.

---

From: [email-masked] (Christopher Bertels)
Date: Fri, 05 Jun 2009 13:24:07 +0200

Ok, wasn't so hard.
Here's the patch:

diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
index 2b6c58b..1e014c3 100644
--- a/lib/sup/modes/thread-view-mode.rb
+++ b/lib/sup/modes/thread-view-mode.rb
@@ -234,10 +234,12 @@ EOS
   ## view.
   def activate_chunk
     chunk = @chunk_lines[curpos] or return
+    move_to_next = false
     if chunk.is_a? Chunk::Text
       ## if the cursor is over a text region, expand/collapse the
       ## entire message
       chunk = @message_lines[curpos]
+      move_to_next = true
     end
     layout = if chunk.is_a?(Message)
       @layout[chunk]
@@ -253,7 +255,7 @@ EOS
     end
     if chunk.is_a?(Message)
       jump_to_message chunk
-      jump_to_next_open
+      jump_to_next_open if move_to_next
     end
   end

---

From: [email-masked] (William Morgan)
Date: Fri, 05 Jun 2009 08:31:31 -0700

Reformatted excerpts from Christopher Bertels's message of 2009-06-05:
> Ok, wasn't so hard.  Here's the patch:

I've applied a similar change to master. Thanks!
-- 
William <wmorgan-sup at masanjin.net>