]> git.notmuchmail.org Git - sup/commitdiff
fix crypto message expand/collapse behavior
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Thu, 27 Sep 2007 00:18:12 +0000 (00:18 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Thu, 27 Sep 2007 00:18:12 +0000 (00:18 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@597 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/crypto.rb
lib/sup/modes/thread-view-mode.rb

index 5aca1a4d15653b9e76c2dbd20e8d9105b6ddb93f..69b940816ee65c1f8110d5afec01c4448607f3e3 100644 (file)
@@ -132,6 +132,6 @@ end
 
 ## to check:
 ## failed decryption
-## decription but failed signature
+## decryption but failed signature
 ## no gpg found
 ## multiple private keys
index f0e8e637f4c82d67ec3017a47efb7697d2914722..f2ad5474ce18216f878817d59fa77c13fb943ff8 100644 (file)
@@ -172,6 +172,10 @@ class ThreadViewMode < LineCursorMode
     UpdateManager.relay self, :label, m
   end
 
+  ## a little overly complicated. for quotes and signatures, if it's
+  ## one line, we just display it and don't allow for
+  ## collapsing/expanding. for crypto notices, we allow
+  ## expanding/collapsing iff the # of notice lines is > 0.
   def toggle_expanded
     chunk = @chunk_lines[curpos] or return
     case chunk
@@ -179,7 +183,10 @@ class ThreadViewMode < LineCursorMode
       l = @layout[chunk]
       l.state = (l.state != :closed ? :closed : :open)
       cursor_down if l.state == :closed
-    when Message::Quote, Message::Signature, CryptoSignature, CryptoDecryptedNotice
+    when CryptoSignature, CryptoDecryptedNotice
+      return if chunk.lines.empty?
+      toggle_chunk_expansion chunk
+    when Message::Quote, Message::Signature
       return if chunk.lines.length <= 1
       toggle_chunk_expansion chunk
     when Message::Attachment