end
Thread.abort_on_exception = true # make debugging possible
+Thread.current.priority = 1 # keep ui responsive
module Redwood
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
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
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
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
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