bin/sup in sup-0.13.2.1 vs bin/sup in sup-0.14.0

- old
+ new

@@ -1,17 +1,16 @@ #!/usr/bin/env ruby +# encoding: utf-8 $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib]) require 'rubygems' require 'ncursesw' no_gpgme = false begin - # gpgme broke its API in 2.0, so make sure we have the old version for now. - gem 'gpgme', '=1.0.8' require 'gpgme' rescue LoadError no_gpgme = true end @@ -156,11 +155,15 @@ Index.load Index.start_sync_worker unless $opts[:no_threads] $die = false trap("TERM") { |x| $die = true } - trap("WINCH") { |x| BufferManager.sigwinch_happened! } + trap("WINCH") do |x| + ::Thread.new do + BufferManager.sigwinch_happened! + end + end if(s = Redwood::SourceManager.source_for DraftManager.source_name) DraftManager.source = s else debug "no draft source, auto-adding..." @@ -288,12 +291,12 @@ when :list_contacts b, new = bm.spawn_unless_exists("Contact List") { ContactListMode.new } b.mode.load_in_background if new when :search completions = LabelManager.all_labels.map { |l| "label:#{LabelManager.string_for l}" } - completions = completions.each { |l| l.force_encoding 'UTF-8' if l.methods.include?(:encoding) } - completions += ["from:", "to:", "after:", "before:", "date:", "limit:", "AND", "OR", "NOT"] + completions = completions.each { |l| l.fix_encoding } + completions += Index::COMPL_PREFIXES query = BufferManager.ask_many_with_completions :search, "Search all messages (enter for saved searches): ", completions unless query.nil? if query.empty? bm.spawn_unless_exists("Saved searches") { SearchListMode.new } else @@ -302,11 +305,11 @@ end when :search_unread SearchResultsMode.spawn_from_query "is:unread" when :list_labels labels = LabelManager.all_labels.map { |l| LabelManager.string_for l } - labels = labels.each { |l| l.force_encoding 'UTF-8' if l.methods.include?(:encoding) } + labels = labels.each { |l| l.fix_encoding } user_label = bm.ask_with_completions :label, "Show threads with label (enter for listing): ", labels unless user_label.nil? if user_label.empty? bm.spawn_unless_exists("Label list") { LabelListMode.new } if user_label && user_label.empty? @@ -410,10 +413,10 @@ $stderr.puts <<EOS ---------------------------------------------------------------- We are very sorry. It seems that an error occurred in Sup. Please accept our sincere apologies. Please submit the contents of #{BASE_DIR}/exception-log.txt and a brief report of the -circumstances to https://github.com/sup-heliotrope/sup/issues so that +circumstances to https://github.com/sup-heliotrope/sup/issues so that we might address this problem. Thank you! Sincerely, The Sup Developers ----------------------------------------------------------------