]> git.cworth.org Git - sup/commitdiff
Merge branch 'preemptive-loading' into next
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Thu, 3 Sep 2009 17:53:47 +0000 (13:53 -0400)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Thu, 3 Sep 2009 17:53:47 +0000 (13:53 -0400)
1  2 
bin/sup
lib/sup/modes/thread-index-mode.rb

diff --combined bin/sup
index cdf1ff24169cc5b1da1e27d2cf4f03ac2969daa6,de0572cfda2cda7f83ebcc33597db5a2a72331ab..5049879cd16432661bb46fb8176b008f89c1eab2
+++ b/bin/sup
@@@ -58,6 -58,7 +58,7 @@@ if $opts[:list_hooks
  end
  
  Thread.abort_on_exception = true # make debugging possible
+ Thread.current.priority = 1 # keep ui responsive
  
  module Redwood
  
@@@ -79,7 -80,6 +80,7 @@@ global_keymap = Keymap.new do |k
    k.add :nothing, "Do nothing", :ctrl_g
    k.add :recall_draft, "Edit most recent draft message", 'R'
    k.add :show_inbox, "Show the Inbox buffer", 'I'
 +  k.add :show_console, "Show the Console buffer", '~'
  end
  
  ## the following magic enables wide characters when used with a ruby
@@@ -169,9 -169,6 +170,9 @@@ begi
    lmode.on_kill { Logger.clear! }
    Logger.add_sink lmode
    Logger.force_message "Welcome to Sup! Log level is set to #{Logger.level}."
 +  if Logger::LEVELS.index(Logger.level) > 0
 +    Logger.force_message "For more verbose logging, restart with SUP_LOG_LEVEL=#{Logger::LEVELS[Logger::LEVELS.index(Logger.level)-1]}."
 +  end
  
    debug "initializing inbox buffer"
    imode = InboxMode.new
  
      bm.erase_flash
  
 -    action = begin
 -      if bm.handle_input c
 +    action =
 +      begin
 +        if bm.handle_input c
 +          :nothing
 +        else
 +          bm.resolve_input_with_keymap c, global_keymap
 +        end
 +      rescue InputSequenceAborted
          :nothing
 -      else
 -        bm.resolve_input_with_keymap c, global_keymap
        end
 -    rescue InputSequenceAborted
 -      :nothing
 -    end
      case action
      when :quit_now
        break if bm.kill_all_buffers_safely
        end
      when :show_inbox
        BufferManager.raise_to_front ibuf
 +    when :show_console
 +      b, new = bm.spawn_unless_exists("Console", :system => true) { ConsoleMode.new }
 +      b.mode.run
      when :nothing, InputSequenceAborted
      when :redraw
        bm.completely_redraw_screen
index 5038d29f308fb5a609c783add43e401d011b34a9,177431b5248ea87e84226a5a9b8cac05ff0ef53b..82f258b689681183614b65d6475829ba10d0563e
@@@ -40,7 -40,6 +40,7 @@@ EO
      k.add :save, "Save changes now", '$'
      k.add :jump_to_next_new, "Jump to next new thread", :tab
      k.add :reply, "Reply to latest message in a thread", 'r'
 +    k.add :reply_all, "Reply to all participants of the latest message in a thread", 'G'
      k.add :forward, "Forward latest message in a thread", 'f'
      k.add :toggle_tagged, "Tag/untag selected thread", 't'
      k.add :toggle_tagged_all, "Tag/untag all threads", 'T'
@@@ -77,8 -76,7 +77,7 @@@
      @last_load_more_size = nil
      to_load_more do |size|
        next if @last_load_more_size == 0
-       load_threads :num => 1, :background => false
-       load_threads :num => (size - 1),
+       load_threads :num => size,
                     :when_done => lambda { |num| @last_load_more_size = num }
      end
    end
        mode = ThreadViewMode.new t, @hidden_labels, self
        BufferManager.spawn t.subj, mode
        BufferManager.draw_screen
 -      mode.jump_to_first_open true
 +      mode.jump_to_first_open
        BufferManager.draw_screen # lame TODO: make this unnecessary
        ## the first draw_screen is needed before topline and botline
        ## are set, and the second to show the cursor having moved
      end
    end
  
 -  def reply
 +  def reply type_arg=nil
      t = cursor_thread or return
      m = t.latest_message
      return if m.nil? # probably won't happen
      m.load_from_source!
 -    mode = ReplyMode.new m
 +    mode = ReplyMode.new m, type_arg
      BufferManager.spawn "Reply to #{m.subj}", mode
    end
  
 +  def reply_all; reply :all; end
 +
    def forward
      t = cursor_thread or return
      m = t.latest_message
          BufferManager.draw_screen
          last_update = Time.now
        end
+       ::Thread.pass
        break if @interrupt_search
      end
      @ts.threads.each { |th| th.labels.each { |l| LabelManager << l } }