]> git.cworth.org Git - sup/commitdiff
bugfix: tagged thread input, output and counting
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Tue, 5 Jun 2007 16:56:15 +0000 (16:56 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Tue, 5 Jun 2007 16:56:15 +0000 (16:56 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@437 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/buffer.rb
lib/sup/tagger.rb

index 1bd03321a0ded5740882630e7c3dd718fa042157..bb94fbe60ea87107c036c07732b8faf455af5a57 100644 (file)
@@ -350,7 +350,7 @@ class BufferManager
     done = false
     @shelled = true
     until done
-      key = Ncurses.nonblocking_getch
+      key = Ncurses.nonblocking_getch or next
       if key == Ncurses::KEY_CANCEL
         done = true
       elsif (accept && accept.member?(key)) || !accept
index 424dac26409c7e45dc45029997e61b9b69374997..464f1ac4d49fe0a8fdcf783aca0e9c38f3e3318d 100644 (file)
@@ -12,23 +12,23 @@ class Tagger
   def drop_tag_for o; @tagged.delete o; end
 
   def apply_to_tagged
-    num_tagged = @tagged.map { |t| t ? 1 : 0 }.sum
+    targets = @tagged.select_by_value
+    num_tagged = targets.size
     if num_tagged == 0
-      BufferManager.flash "No tagged messages!"
+      BufferManager.flash "No tagged threads!"
       return
     end
 
-    noun = num_tagged == 1 ? "message" : "messages"
+    noun = num_tagged == 1 ? "thread" : "threads"
     c = BufferManager.ask_getch "apply to #{num_tagged} tagged #{noun}:"
     return if c.nil? # user cancelled
 
-    if(action = @mode.resolve_input c)
+    if(action = @mode.resolve_input(c))
       tagged_sym = "multi_#{action}".intern
       if @mode.respond_to? tagged_sym
-        targets = @tagged.select_by_value
         @mode.send tagged_sym, targets
       else
-        BufferManager.flash "That command cannot be applied to multiple messages."
+        BufferManager.flash "That command cannot be applied to multiple threads."
       end
     else
       BufferManager.flash "Unknown command #{c.to_character}."