+ UndoManager.register "archiving #{threads.size.pluralize 'thread'}" do
+ threads.map do |t|
+ t.apply_label :inbox
+ add_or_unhide t.first
+ end
+ regen_text
+ end
+
+ threads.each do |t|
+ t.remove_label :inbox
+ hide_thread t
+ end
+ regen_text
+ end
+
+ def read_and_archive
+ return unless cursor_thread
+ thread = cursor_thread # to make sure lambda only knows about 'old' cursor_thread
+
+ UndoManager.register "reading and archiving thread" do
+ thread.apply_label :inbox
+ thread.apply_label :unread
+ add_or_unhide thread.first
+ end
+
+ cursor_thread.remove_label :unread
+ cursor_thread.remove_label :inbox
+ hide_thread cursor_thread
+ regen_text
+ end
+
+ def multi_read_and_archive threads
+ old_labels = threads.map { |t| t.labels.dup }
+