]> git.cworth.org Git - sup/commitdiff
convert a couple of arrays to sets for labels
authorCarl Worth <cworth@cworth.org>
Thu, 20 Aug 2009 00:21:59 +0000 (17:21 -0700)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Sun, 23 Aug 2009 17:58:56 +0000 (13:58 -0400)
This fixes some crashes when using 'l' in thread-view-mode that
have been present since commit 7aea418a8a62b7070eee764475fcfc0bdd8d58dd
("maintain labels as Sets rather than arrays").

lib/sup/buffer.rb
lib/sup/modes/thread-view-mode.rb

index 3bd3fe8e96a1563ff3ae4fa748b80203a1320cb8..2f2dbdaf2f5f3894a4b60728486574c4ce325769 100644 (file)
@@ -484,7 +484,7 @@ EOS
   ## returns an array of labels
   def ask_for_labels domain, question, default_labels, forbidden_labels=[]
     default_labels = default_labels - forbidden_labels - LabelManager::RESERVED_LABELS
-    default = default_labels.join(" ")
+    default = default_labels.to_a.join(" ")
     default += " " unless default.empty?
 
     # here I would prefer to give more control and allow all_labels instead of
index 737f6f1ff309a5bd87ebdeb1d213c77c88b86bc2..4f9c147f3a6746c0acaf5c75c34436a898a9b7cb 100644 (file)
@@ -253,7 +253,7 @@ EOS
     new_labels = BufferManager.ask_for_labels :label, "Labels for thread: ", @thread.labels
 
     return unless new_labels
-    @thread.labels = (reserved_labels + new_labels).uniq
+    @thread.labels = Set.new(reserved_labels) + new_labels
     new_labels.each { |l| LabelManager << l }
     update
     UpdateManager.relay self, :labeled, @thread.first