From d050c9b64c3a7e7867d3aada216f137093409a34 Mon Sep 17 00:00:00 2001 From: William Morgan Date: Thu, 4 Jun 2009 23:32:28 -0400 Subject: [PATCH] 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. --- lib/sup/modes/thread-view-mode.rb | 20 ++++++++++++++------ 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 index 42c6280..2b6c58b 100644 --- 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 -- 2.45.2