]> git.cworth.org Git - sup/blobdiff - bin/sup
Allow thread index view to sort oldest first
[sup] / bin / sup
diff --git a/bin/sup b/bin/sup
index 3d5b6c1da0207cd0ec41b8756522f3a4c6880a4b..43a26fca4127cdc227c1cc6ee356d74ac9d1e8c7 100755 (executable)
--- a/bin/sup
+++ b/bin/sup
@@ -58,6 +58,7 @@ if $opts[:list_hooks]
 end
 
 Thread.abort_on_exception = true # make debugging possible
+Thread.current.priority = 1 # keep ui responsive
 
 module Redwood
 
@@ -169,6 +170,9 @@ begin
   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
@@ -201,13 +205,13 @@ begin
   end
 
   if $opts[:search]
-    SearchResultsMode.spawn_from_query $opts[:search]
+    SearchResultsMode.spawn_from_query $opts[:search], true
   end
 
   until Redwood::exceptions.nonempty? || $die
     c = begin
       Ncurses.nonblocking_getch
-    rescue Interrupt => e
+    rescue Interrupt
       raise if BufferManager.ask_yes_or_no "Die ungracefully now?"
       BufferManager.draw_screen
       nil
@@ -263,9 +267,9 @@ begin
     when :search
       query = BufferManager.ask :search, "search all messages: "
       next unless query && query !~ /^\s*$/
-      SearchResultsMode.spawn_from_query query
+      SearchResultsMode.spawn_from_query query, true
     when :search_unread
-      SearchResultsMode.spawn_from_query "is:unread"
+      SearchResultsMode.spawn_from_query "is:unread", InboxMode.newest_first
     when :list_labels
       labels = LabelManager.all_labels.map { |l| LabelManager.string_for l }
       user_label = bm.ask_with_completions :label, "Show threads with label (enter for listing): ", labels