commit e7c11ce565194d0b773c4ffae77a57386fe1f90b
parent d3e1ccd43bbd1b6c4076dfe110deede57e1b1bab
Author: Carl Worth <cworth@cworth.org>
Date: Wed, 19 Aug 2009 17:21:59 -0700
convert a couple of arrays to sets for labels
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").
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
@@ -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
diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
@@ -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