commit d050c9b64c3a7e7867d3aada216f137093409a34
parent 6be48f657c6c514c362184e3b36d9e3a66cf3a5f
Author: William Morgan <wmorgan-sup@masanjin.net>
Date: Thu, 4 Jun 2009 23:32:28 -0400
make enter collapse current message in thread-view-mode
Pressing enter while over a text region in thread-view-mode will now
collapse the current message and move the cursor to the next open
message. (Behavior on quoted regions, sigs, attachments, etc. is
unchanged.)
This means that you can scan through a thread pretty rapidly by pressing
enter if you want to collapse the current message, or 'n' if you want
to keep it open.
Diffstat:
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
@@ -234,12 +234,16 @@ EOS
## view.
def activate_chunk
chunk = @chunk_lines[curpos] or return
- layout =
- if chunk.is_a?(Message)
- @layout[chunk]
- elsif chunk.expandable?
- @chunk_layout[chunk]
- end
+ if chunk.is_a? Chunk::Text
+ ## if the cursor is over a text region, expand/collapse the
+ ## entire message
+ chunk = @message_lines[curpos]
+ end
+ layout = if chunk.is_a?(Message)
+ @layout[chunk]
+ elsif chunk.expandable?
+ @chunk_layout[chunk]
+ end
if layout
layout.state = (layout.state != :closed ? :closed : :open)
#cursor_down if layout.state == :closed # too annoying
@@ -247,6 +251,10 @@ EOS
elsif chunk.viewable?
view chunk
end
+ if chunk.is_a?(Message)
+ jump_to_message chunk
+ jump_to_next_open
+ end
end
def edit_as_new