sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 0ccf7a3ed8e467ee271527929ad8213a85821549
parent 19b9b8885ddec06fa8606268c8010fea3fcabb6d
Author: Hamish Downer <dmishd@gmail.com>
Date:   Mon, 20 Jun 2011 23:58:01 +0100

Allows toggling 'killed' status of a thread

UpdateManager didn't seem responsive to 'killed'/'unkilled' so uses 'labeled'.

Patch actually written by Evan Hanson vnhnsn at gmail dot comma

Diffstat:
M lib/sup/modes/thread-index-mode.rb | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
@@ -476,23 +476,35 @@ EOS
 
   ## m-m-m-m-MULTI-KILL
   def multi_kill threads
-    UndoManager.register "killing #{threads.size.pluralize 'thread'}" do
+    UndoManager.register "killing/unkilling #{threads.size.pluralize 'threads'}" do
       threads.each do |t|
-        t.remove_label :killed
-        add_or_unhide t.first
+        if t.toggle_label :killed
+          add_or_unhide t.first
+        else
+          hide_thread t
+        end
+      end.each do |t|
+        UpdateManager.relay self, :labeled, t.first
         Index.save_thread t
       end
       regen_text
     end
 
     threads.each do |t|
-      t.apply_label :killed
-      hide_thread t
+      if t.toggle_label :killed
+        hide_thread t
+      else
+        add_or_unhide t.first
+      end
+    end.each do |t|
+      # send 'labeled'... this might be more specific
+      UpdateManager.relay self, :labeled, t.first
+      Index.save_thread t
     end
 
+    killed, unkilled = threads.partition { |t| t.has_label? :killed }.map(&:size)
+    BufferManager.flash "#{killed.pluralize 'thread'} killed, #{unkilled} unkilled"
     regen_text
-    BufferManager.flash "#{threads.size.pluralize 'thread'} killed."
-    threads.each { |t| Index.save_thread t }
   end
 
   def cleanup