Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH] Don’t display "..." after snippets which are displayed completely
@ 2010-06-16 18:11 Michael Stapelberg
  2010-07-01 21:32 ` Cameron Matheson
  2010-07-03  2:33 ` Rich Lane
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Stapelberg @ 2010-06-16 18:11 UTC (permalink / raw)
  To: sup-devel

[-- Attachment #1: Type: text/plain, Size: 348 bytes --]

Hi,

quote from the commit message:
    Don’t display "..." after snippets which are displayed completely
    
    Short mails (for example: "Yes, the date works for me.") often can
    be displayed completely in the snippet. However, before this patch,
    sup abbreviated the snippet even though it was not abbreviated.


Best regards,
Michael

[-- Attachment #2: 0001-Don-t-display-.-after-snippets-which-are-displayed-c.patch --]
[-- Type: application/octet-stream, Size: 2085 bytes --]

From 0e68a2ab2b49cff0daf2b99ae705f6df3ac8649b Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Wed, 16 Jun 2010 20:08:30 +0200
Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20display=20"..."=20after=20snippets=20which=20are=20displayed=20completely?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Short mails (for example: "Yes, the date works for me.") often can
be displayed completely in the snippet. However, before this patch,
sup abbreviated the snippet even though it was not abbreviated.
---
 lib/sup/message.rb                 |    2 ++
 lib/sup/modes/thread-index-mode.rb |    4 +---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index b70bc6b..6c5f199 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -656,7 +656,9 @@ private
         @snippet ||= ""
         @snippet += " " unless @snippet.empty?
         @snippet += line.gsub(/^\s+/, "").gsub(/[\r\n]/, "").gsub(/\s+/, " ")
+        oldlen = @snippet.length
         @snippet = @snippet[0 ... SNIPPET_LEN].chomp
+        @snippet += "..." if @snippet.length < oldlen
         @dirty = true unless encrypted && $config[:discard_snippets_from_encrypted_messages]
         @snippet_contains_encrypted_content = true if encrypted
       end
diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
index ed9a3eb..0c7a3f2 100644
--- a/lib/sup/modes/thread-index-mode.rb
+++ b/lib/sup/modes/thread-index-mode.rb
@@ -876,8 +876,6 @@ protected
         :index_old_color
       end
 
-    snippet = t.snippet + (t.snippet.empty? ? "" : "...")
-
     size_padding = @size_widget_width - size_widget.display_length
     size_widget_text = sprintf "%#{size_padding}s%s", "", size_widget
 
@@ -898,7 +896,7 @@ protected
       (t.labels - @hidden_labels).map { |label| [:label_color, "#{label} "] } +
       [
       [subj_color, t.subj + (t.subj.empty? ? "" : " ")],
-      [:snippet_color, snippet],
+      [:snippet_color, t.snippet],
     ]
   end
 
-- 
1.6.5


[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-03  2:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-16 18:11 [sup-devel] [PATCH] Don’t display "..." after snippets which are displayed completely Michael Stapelberg
2010-07-01 21:32 ` Cameron Matheson
2010-07-03  2:33 ` Rich Lane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox