From: William Morgan Date: Sun, 30 Dec 2007 19:03:23 +0000 (-0800) Subject: added ThreadIndexMode#launch_next_thread_after to support dispatch-then-kill X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=34570f64c113bbb5ee57a47a30e9a467e4902a39;p=sup added ThreadIndexMode#launch_next_thread_after to support dispatch-then-kill --- diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index 67bf05f..0abeb62 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -75,7 +75,7 @@ EOS end ## open up a thread view window - def select t=nil + def select t=nil, when_done=nil t ||= cursor_thread or return Redwood::reporting_thread("load messages for thread-view-mode") do @@ -98,12 +98,28 @@ EOS update_text_for_line curpos UpdateManager.relay self, :read, t.first + when_done.call if when_done end end def multi_select threads threads.each { |t| select t } end + + ## this is called by thread-view-modes when the user wants to view + ## the next thread without going to index-mode. we update the cursor + ## as a convenience. + def launch_next_thread_after thread, &b + l = @lines[thread] or return + t = @mutex.synchronize do + if l < @threads.length - 1 + set_cursor_pos l + 1 # move out of mutex? + @threads[l + 1] + end + end or return + + select t, b + end def handle_single_message_labeled_update sender, m ## no need to do anything different here; we don't differentiate