From: Carl Worth Date: Thu, 20 Aug 2009 00:21:59 +0000 (-0700) Subject: convert a couple of arrays to sets for labels X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=e7c11ce565194d0b773c4ffae77a57386fe1f90b;p=sup 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"). --- diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb index 3bd3fe8..2f2dbda 100644 --- 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 index 737f6f1..4f9c147 100644 --- 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