Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Michael Stapelberg <michael+sup@stapelberg.de>
To: sup-devel <sup-devel@rubyforge.org>
Subject: [sup-devel] [PATCH] Don’t display "..." after snippets which are displayed completely
Date: Wed, 16 Jun 2010 20:11:47 +0200	[thread overview]
Message-ID: <1276711781-sup-4102@midna.zekjur.net> (raw)

[-- 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

             reply	other threads:[~2010-06-16 18:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-16 18:11 Michael Stapelberg [this message]
2010-07-01 21:32 ` Cameron Matheson
2010-07-03  2:33 ` Rich Lane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1276711781-sup-4102@midna.zekjur.net \
    --to=michael+sup@stapelberg.de \
    --cc=sup-devel@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox