[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sup-devel] [sup-talk] Label Display; Sorting Alphabetically



Excerpts from Philippe LeCavalier's message of Wed Feb 16 13:33:32 +0000 2011:
> > Philippe LeCavalier, 2011-02-15 17:37:
> > > Hi All. Just wondering if there has ever been any consideration to
> > > sorting labels alphabetically. I'm assuming the way sup displays the
> > > labels is purely esthetic's?
> > 
> > I assume you are talking about thread index mode.
> No. Any mode really. Even in search mode they're random.

No longer! I've published a branch called order_labels that will fix
this, both in the various thread index modes, and when editing the
labels for a message. Diffs at the end of the email for your viewing
pleasure ...

I'll merge this into next when I'm a bit more awake - been up a bit long
...

Hamish Downer



commit 1ae7c0a1e5b20681ea6ecb9a6bf15fffa5f4c0e3
Author: Hamish Downer <dmishd@gmail.com>
Date:   Sun Feb 20 22:57:47 2011 +0000

    Order labels alphabetically in thread index mode

diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
index 11548c7..36d6db3 100644
--- a/lib/sup/modes/thread-index-mode.rb
+++ b/lib/sup/modes/thread-index-mode.rb
@@ -893,7 +893,7 @@ protected
       [:to_me_color, t.labels.member?(:attachment) ? "@" : " "],
       [:to_me_color, dp ? ">" : (p ? '+' : " ")],
     ] +
-      (t.labels - @hidden_labels).map { |label| [:label_color, "#{label} "] } +
+      (t.labels - @hidden_labels).sort_by {|x| x.to_s}.map { |label| [:label_color, "#{label} "] } +
       [
       [subj_color, t.subj + (t.subj.empty? ? "" : " ")],
       [:snippet_color, t.snippet],




commit 490e57254c5ee493e8acf4b8358b54e7eb3ab698
Author: Hamish Downer <dmishd@gmail.com>
Date:   Sun Feb 20 23:22:05 2011 +0000

    When editing labels, they are presented in alphabetical order

diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
index 36d6db3..613aa61 100644
--- a/lib/sup/modes/thread-index-mode.rb
+++ b/lib/sup/modes/thread-index-mode.rb
@@ -542,7 +542,7 @@ EOS
 
     keepl, modifyl = thread.labels.partition { |t| speciall.member? t }
 
-    user_labels = BufferManager.ask_for_labels :label, "Labels for thread: ", modifyl, @hidden_labels
+    user_labels = BufferManager.ask_for_labels :label, "Labels for thread: ", modifyl.sort_by {|x| x.to_s}, @hidden_labels
     return unless user_labels
 
     thread.labels = Set.new(keepl) + user_labels
diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
index 59705bc..e69de57 100644
--- a/lib/sup/modes/thread-view-mode.rb
+++ b/lib/sup/modes/thread-view-mode.rb
@@ -282,7 +282,7 @@ EOS
   def edit_labels
     old_labels = @thread.labels
     reserved_labels = old_labels.select { |l| LabelManager::RESERVED_LABELS.include? l }
-    new_labels = BufferManager.ask_for_labels :label, "Labels for thread: ", @thread.labels
+    new_labels = BufferManager.ask_for_labels :label, "Labels for thread: ", @thread.labels.sort_by {|x| x.to_s}
 
     return unless new_labels
     @thread.labels = Set.new(reserved_labels) + new_labels
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel