Even if the labels.txt file is read as UTF-8 apparantly after a label is symoblized, it will be US-ASCII on .to_s if possible. This patch forces UTF-8.
If you use L to select a US-ASCII label (i.e. Sent) then want to narrow
the search by pressing L again and use tab to match against an UTF-8
label sup crashes.
Also fixes one whitespace error in bin/sup
---
bin/sup | 4 +++-
lib/sup/buffer.rb | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/bin/sup b/bin/sup
index fd1dde8..10be161 100755
--- a/bin/sup
+++ b/bin/sup
@@ -49,7 +49,7 @@ No variables.
No return value.
EOS
-Redwood::HookManager.register "shutdown", <<EOS
+Redwood::HookManager.register "shutdown", <<EOS
Executes when sup is shutting down. May be run when sup is crashing,
so don\'t do anything too important. Run before the label, contacts,
and people are saved.
@@ -299,6 +299,8 @@ begin
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) }
+
user_label = bm.ask_with_completions :label, "Show threads with label
(enter for listing): ", labels
unless user_label.nil?
if user_label.empty?
diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
index f3cfb8a..c36ca56 100644
--- a/lib/sup/buffer.rb
+++ b/lib/sup/buffer.rb
@@ -454,7 +454,7 @@ EOS
def ask_with_completions domain, question, completions, default=nil
ask domain, question, default do |s|
s.force_encoding 'UTF-8' if s.methods.include?(:encoding)
- completions.select { |x| x =~ /^#{Regexp::escape s}/i }.map { |x| [x, x]
}
+ completions.select { |x| x =~ /^#{Regexp::escape s}/iu }.map { |x| [x,
x] }
end
end
--
1.7.3.2
0001-More-UTF-8-support-load-all-labels-as-UTF-8.patch
Description: Binary data
_______________________________________________ Sup-devel mailing list [email protected] http://rubyforge.org/mailman/listinfo/sup-devel
