* [PATCH] More UTF-8 support; load all labels as UTF-8
@ 2010-11-04 13:21 Gaute Hope
2010-11-04 16:03 ` [sup-devel] " Rich Lane
0 siblings, 1 reply; 2+ messages in thread
From: Gaute Hope @ 2010-11-04 13:21 UTC (permalink / raw)
To: sup-devel
[-- Attachment #1: Type: text/plain, Size: 1852 bytes --]
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
[-- Attachment #2: 0001-More-UTF-8-support-load-all-labels-as-UTF-8.patch --]
[-- Type: application/octet-stream, Size: 2061 bytes --]
From 13258929b9083a88ad9c6ba924e1093fe032e899 Mon Sep 17 00:00:00 2001
From: Gaute Hope <eg@gaute.vetsj.com>
Date: Thu, 4 Nov 2010 14:12:09 +0100
Subject: [PATCH] More UTF-8 support; load all labels as UTF-8
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [sup-devel] [PATCH] More UTF-8 support; load all labels as UTF-8
2010-11-04 13:21 [PATCH] More UTF-8 support; load all labels as UTF-8 Gaute Hope
@ 2010-11-04 16:03 ` Rich Lane
0 siblings, 0 replies; 2+ messages in thread
From: Rich Lane @ 2010-11-04 16:03 UTC (permalink / raw)
To: Gaute Hope; +Cc: sup-devel
Applied to master.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-11-04 16:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-04 13:21 [PATCH] More UTF-8 support; load all labels as UTF-8 Gaute Hope
2010-11-04 16:03 ` [sup-devel] " Rich Lane
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox