sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 8e0c182dad332960ebf53b87fb402ea1e049d779
parent 4dd15eedad428112b1f18deb02b465ec6c71f96c
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date:   Thu, 27 Sep 2007 00:18:12 +0000

fix crypto message expand/collapse behavior

git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@597 5c8cc53c-5e98-4d25-b20a-d8db53a31250

Diffstat:
M lib/sup/crypto.rb | 2 +-
M lib/sup/modes/thread-view-mode.rb | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
@@ -132,6 +132,6 @@ end
 
 ## to check:
 ## failed decryption
-## decription but failed signature
+## decryption but failed signature
 ## no gpg found
 ## multiple private keys
diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
@@ -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