]> git.cworth.org Git - sup/commitdiff
Added undo for delete thread
authorMike Stipicevic <stipim@rpi.edu>
Mon, 16 Feb 2009 05:10:32 +0000 (00:10 -0500)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Mon, 16 Mar 2009 12:00:00 +0000 (08:00 -0400)
lib/sup/modes/thread-index-mode.rb

index ae7c299c7c622d94243c33a3e27f738679605928..159839d2d3a08e912e662c9887ab3b19d286b8a5 100644 (file)
@@ -443,11 +443,18 @@ EOS
     multi_kill [t]
   end
 
+  ## m-m-m-m-MULTI-KILL
   def multi_kill threads
-    threads.each do |t|
+    undo = threads.map do |t|
       t.apply_label :killed
       hide_thread t
+      thread = t
+      lambda { thread.remove_label :killed
+        add_or_unhide thread.first
+      }
     end
+    UndoManager.register("killing #{threads.size} #{threads.size.pluralize 'thread'}",
+                         undo << lambda {regen_text})
     regen_text
     BufferManager.flash "#{threads.size.pluralize 'Thread'} killed."
   end