Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Evan Hanson <vnhnsn@gmail.com>
To: sup-devel <sup-devel@rubyforge.org>
Subject: [sup-devel] [PATCH] toggle killed status
Date: Sat, 23 Apr 2011 19:46:59 -0500	[thread overview]
Message-ID: <1303605889-sup-5283@Apollo.local> (raw)


[-- Attachment #1.1.1: Type: text/plain, Size: 203 bytes --]

Attached allows toggling 'killed' status of a thread. If there was a way to do
this previously, please ignore.

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

Evan

[-- Attachment #1.1.2: toggle-killed-status.patch --]
[-- Type: application/octet-stream, Size: 1464 bytes --]

diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
index 11548c7..943065e 100644
--- a/lib/sup/modes/thread-index-mode.rb
+++ b/lib/sup/modes/thread-index-mode.rb
@@ -473,23 +473,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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

             reply	other threads:[~2011-04-24  0:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-24  0:46 Evan Hanson [this message]
2011-06-20 23:01 ` Hamish Downer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1303605889-sup-5283@Apollo.local \
    --to=vnhnsn@gmail.com \
    --cc=sup-devel@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox