]> git.cworth.org Git - sup/commitdiff
make '#' in thread-index-mode join all tagged threads into one thread
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Thu, 17 Jan 2008 00:50:51 +0000 (16:50 -0800)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Thu, 17 Jan 2008 00:50:51 +0000 (16:50 -0800)
No way to reverse this, yet.

lib/sup/modes/thread-index-mode.rb

index 0d90be48f1ee9b4eae2a6cf8064a2cfed16a4cc8..dec3c1df47ad2db9bb24b2fd660d961955baef91 100644 (file)
@@ -33,6 +33,7 @@ EOS
     k.add :toggle_tagged_all, "Tag/untag all threads", 'T'
     k.add :tag_matching, "Tag matching threads", 'g'
     k.add :apply_to_tagged, "Apply next command to all tagged threads", ';'
+    k.add :join_threads, "Force tagged threads to be joined into the same thread", '#'
   end
 
   def initialize hidden_labels=[], load_thread_opts={}
@@ -278,6 +279,18 @@ EOS
     regen_text
   end
 
+  def join_threads
+    ## this command has no non-tagged form. as a convenience, allow this
+    ## command to be applied to tagged threads without hitting ';'.
+    @tags.apply_to_tagged :join_threads
+  end
+
+  def multi_join_threads threads
+    @ts.join_threads threads or return
+    @tags.drop_all_tags # otherwise we have tag pointers to invalid threads!
+    update
+  end
+
   def jump_to_next_new
     n = @mutex.synchronize do
       ((curpos + 1) ... lines).find { |i| @threads[i].has_label? :unread } ||