]> git.notmuchmail.org Git - sup/blobdiff - bin/sup
fix rakefile local build issues
[sup] / bin / sup
diff --git a/bin/sup b/bin/sup
index 3892016643b97d7399f9e0d8e7240458e2b5537d..cb4542ac340bb015fd3d519c40dc9a6dd808612a 100644 (file)
--- a/bin/sup
+++ b/bin/sup
@@ -119,7 +119,7 @@ begin
     c.add :message_patina_color, Ncurses::COLOR_BLACK, Ncurses::COLOR_GREEN
     c.add :alternate_patina_color, Ncurses::COLOR_BLACK, Ncurses::COLOR_BLUE
     c.add :missing_message_color, Ncurses::COLOR_BLACK, Ncurses::COLOR_RED
-    c.add :mime_color, Ncurses::COLOR_CYAN, Ncurses::COLOR_BLACK
+    c.add :attachment_color, Ncurses::COLOR_CYAN, Ncurses::COLOR_BLACK
     c.add :quote_patina_color, Ncurses::COLOR_YELLOW, Ncurses::COLOR_BLACK
     c.add :sig_patina_color, Ncurses::COLOR_YELLOW, Ncurses::COLOR_BLACK
     c.add :quote_color, Ncurses::COLOR_YELLOW, Ncurses::COLOR_BLACK
@@ -137,6 +137,8 @@ begin
           Ncurses::A_BOLD
     c.add :draft_notification_color, Ncurses::COLOR_RED, Ncurses::COLOR_BLACK,
           Ncurses::A_BOLD
+    c.add :completion_character_color, Ncurses::COLOR_WHITE,
+          Ncurses::COLOR_BLACK, Ncurses::A_BOLD
   end
 
   log "initializing buffer manager"
@@ -168,7 +170,7 @@ begin
     end if s.respond_to? :connect
   end
 
-  imode.load_threads :num => ibuf.content_height, :when_done => lambda { reporting_thread { sleep 1; PollManager.poll } }
+  imode.load_threads :num => ibuf.content_height, :when_done => lambda { reporting_thread { sleep 1; PollManager.poll } unless $opts[:no_threads] }
 
   unless $opts[:no_threads]
     PollManager.start
@@ -179,6 +181,7 @@ begin
   until $exception || SuicideManager.die?
     c = Ncurses.nonblocking_getch
     next unless c
+    bm.erase_flash
 
     unless bm.handle_input(c)
       x = global_keymap.action_for c
@@ -214,12 +217,29 @@ begin
           bm.flash "Couldn't parse query."
         end
       when :list_labels
-        b = bm.spawn_unless_exists("Label list") { LabelListMode.new }
-        b.mode.load_in_background
+        labels = LabelManager.listable_labels.map { |l| LabelManager.string_for l }
+        user_label = bm.ask_with_completions :label, "Show threads with label (enter for listing): ", labels
+        user_label = bm.spawn_modal("Label list", LabelListMode.new) if user_label && user_label.empty?
+        
+        case user_label
+        when nil
+        when :inbox
+          BufferManager.raise_to_front InboxMode.instance.buffer
+        else
+          b = BufferManager.spawn_unless_exists("All threads with label '#{user_label}'") do
+            mode = LabelSearchResultsMode.new([user_label])
+          end
+          b.mode.load_threads :num => b.content_height
+        end
+
       when :compose
-        mode = ComposeMode.new
+        to = BufferManager.ask_for_contacts(:people, "To: ") or next
+        cc = BufferManager.ask_for_contacts(:people, "Cc: ") or next if $config[:ask_for_cc]
+        bcc = BufferManager.ask_for_contacts(:people, "Bcc: ") or next if $config[:ask_for_bcc]
+
+        mode = ComposeMode.new :to => to, :cc => cc, :bcc => bcc
         bm.spawn "New Message", mode
-        mode.edit
+        mode.edit_message
       when :poll
         #          bm.raise_to_front PollManager.buffer
         reporting_thread { PollManager.poll }
@@ -248,27 +268,27 @@ begin
     end
 
     bm.draw_screen
-    bm.erase_flash
   end
 rescue Exception => e
   $exception ||= e
 ensure
   unless $opts[:no_threads]
-    PollManager.stop
-    SuicideManager.stop
+    PollManager.stop if PollManager.instantiated?
+    SuicideManager.stop if PollManager.instantiated?
     Index.stop_lock_update_thread
   end
 
   Redwood::finish
   stop_cursing
+  Redwood::log "stopped cursing"
 
   if SuicideManager.instantiated? && SuicideManager.die?
-    Redwood::log "I've been asked to commit sepuku. I obey!"
+    Redwood::log "I've been ordered to commit sepuku. I obey!"
   end
 
   case $exception
   when nil
-    Redwood::log "good night, sweet prince!"
+    Redwood::log "no fatal errors. good job, william."
     Index.save
   else
     Redwood::log "oh crap, an exception"
@@ -283,7 +303,7 @@ if $exception
 I'm very sorry, but it seems that an error occurred in Sup. 
 Please accept my sincere apologies. If you don't mind, please
 send the backtrace below and a brief report of the circumstances
-to wmorgan-sup at masanjin dot nets so that I might address this
+to sup-talk at rubyforge dot orgs so that I might address this
 problem. Thank you!
 
 Sincerely,