From: William Morgan Date: Fri, 5 Jun 2009 03:32:28 +0000 (-0400) Subject: make enter collapse current message in thread-view-mode X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=d050c9b64c3a7e7867d3aada216f137093409a34;p=sup 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. --- 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