From: wmorgan Date: Fri, 5 Jan 2007 21:49:26 +0000 (+0000) Subject: fixed 'n' and 'p' with missing messages, and some comment and logging cleanups X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=685765fbb1bcb206a5b8c33a7b8f7e0da7587264;p=sup fixed 'n' and 'p' with missing messages, and some comment and logging cleanups git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@192 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb index 5fc3a30..e791e6b 100644 --- a/lib/sup/modes/thread-view-mode.rb +++ b/lib/sup/modes/thread-view-mode.rb @@ -173,7 +173,7 @@ class ThreadViewMode < LineCursorMode top, bot, prevm, nextm, depth = @messages[m] jump_to_line top unless top >= topline && top <= botline && bot >= topline && bot <= botline - jump_to_col depth * 2 # sorry!!!! + jump_to_col depth * 2 # sorry!!!! TODO: make this a constant set_cursor_pos top end @@ -195,13 +195,12 @@ class ThreadViewMode < LineCursorMode quotes = @chunks[m].select { |c| c.is_a?(Message::Quote) || c.is_a?(Message::Signature) } open, closed = quotes.partition { |c| @state[c] == :open } newstate = open.length > closed.length ? :closed : :open - Redwood::log "#{open.length} opened, #{closed.length} closed, new state is thus #{newstate}" quotes.each { |c| @state[c] = newstate } update end end - ## kinda slow for large threads. TODO: make faster + ## kinda slow for large threads. TODO: fasterify def cleanup BufferManager.say "Marking messages as read..." do @thread.each do |m, d, p| @@ -262,7 +261,7 @@ private ## also sorry about the * 2. very, very sorry. @messages[m] = [@text.length, @text.length + text.length, prev_m, nil, depth] @messages[prev_m][3] = m if prev_m - prev_m = m + prev_m = m if m.is_a? Message @text += text if @state[m] != :closed && @chunks.member?(m) @@ -301,7 +300,6 @@ private [[prefix_widget, widget, imp_widget, [:message_patina_color, "#{m.from ? m.from.mediumname : '?'} to #{m.recipients.map { |l| l.shortname }.join(', ')} #{m.date.to_nice_s} (#{m.date.to_nice_distance_s})"]]] -# (m.to.empty? ? [] : [[[:message_patina_color, prefix + " To: " + m.recipients.map { |x| x.mediumname }.join(", ")]]]) + when :closed [[prefix_widget, widget, imp_widget, [:message_patina_color, @@ -345,8 +343,8 @@ private [[[:mime_color, "#{prefix}+ MIME attachment #{chunk.content_type}#{chunk.desc ? ' (' + chunk.desc + ')': ''}"]]] when Message::Text t = chunk.lines - if t.last =~ /^\s*$/ - t.pop while t[t.length - 2] =~ /^\s*$/ + if t.last =~ /^\s*$/ && t.length > 1 + t.pop while t[-2] =~ /^\s*$/ # pop until only one file empty line end t.map { |line| [[:none, "#{prefix}#{line}"]] } when Message::Quote