sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit a4e187a6e1e8c653108488070a27218acd4e37fb
parent e2cbd0acdb5ef68d72d813508db1cacb21069d2b
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date:   Wed, 17 Jan 2007 01:39:40 +0000

bugfix


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

Diffstat:
M lib/sup/modes/thread-view-mode.rb | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
@@ -243,6 +243,11 @@ private
 
     prevm = nil
     @thread.each do |m, depth, parent|
+      unless m.is_a? Message # handle nil and :fake_root
+        @text += chunk_to_lines m, nil, @text.length, depth, parent
+        next
+      end
+
       ## we're occasionally called on @threads that have had messages
       ## added to them since initialization. luckily we regen_text on
       ## the entire thread every time the user does anything besides
@@ -253,6 +258,7 @@ private
       ## message if everything's been read) will not be valid, but
       ## that's just a nicety and hopefully this won't happen too
       ## often.
+
       l = (@layout[m] ||= Layout.new)
       l.state ||= initial_state_for m
 
@@ -275,24 +281,21 @@ private
       end
 
       @text += text
-
-      if m.is_a? Message
-        prevm = m 
-        if @layout[m].state != :closed
-          m.chunks.each do |c|
-            cl = (@layout[c] ||= Layout.new)
-            cl.state ||= :closed
-            text = chunk_to_lines c, cl.state, @text.length, depth
-            (0 ... text.length).each do |i|
-              @chunk_lines[@text.length + i] = c
-              @message_lines[@text.length + i] = m
-              lw = text[i].flatten.select { |x| x.is_a? String }.map { |x| x.length }.sum - (depth * INDENT_SPACES)
-              l.width = lw if lw > l.width
-            end
-            @text += text
+      prevm = m 
+      if @layout[m].state != :closed
+        m.chunks.each do |c|
+          cl = (@layout[c] ||= Layout.new)
+          cl.state ||= :closed
+          text = chunk_to_lines c, cl.state, @text.length, depth
+          (0 ... text.length).each do |i|
+            @chunk_lines[@text.length + i] = c
+            @message_lines[@text.length + i] = m
+            lw = text[i].flatten.select { |x| x.is_a? String }.map { |x| x.length }.sum - (depth * INDENT_SPACES)
+            l.width = lw if lw > l.width
           end
-          @layout[m].bot = @text.length
+          @text += text
         end
+        @layout[m].bot = @text.length
       end
     end
   end