Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] [PATCH] Wrap text attachments
@ 2008-11-04  0:08 Israel Herraiz
  2008-11-04 13:29 ` Nicolas Pouillard
  0 siblings, 1 reply; 4+ messages in thread
From: Israel Herraiz @ 2008-11-04  0:08 UTC (permalink / raw)


Hi,

this patch wrap text attachaments, as well as messages. For me is
quite annoying to have to scroll to see the text attachments. Perhaps
it is useful for others too.

Cheers,
Israel

---
 lib/sup/message-chunks.rb |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index cc895f3..99bd12b 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -65,6 +65,8 @@ Return value:
 EOS
 #' stupid ruby-mode
 
+    WRAP_LEN = 80 # wrap text attachments at this width
+
     ## raw_content is the post-MIME-decode content. this is used for
     ## saving the attachment to disk.
     attr_reader :content_type, :filename, :lines, :raw_content
@@ -95,6 +97,7 @@ EOS
       @lines = nil
       if text
         @lines = text.gsub("\r\n", "\n").gsub(/\t/, "        ").gsub(/\r/, "").split("\n")
+        @lines = lines.map {|l| l.chomp.wrap WRAP_LEN}.flatten
         @quotable = true
       end
     end
-- 
1.5.6.5


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

* [sup-talk] [PATCH] Wrap text attachments
  2008-11-04  0:08 [sup-talk] [PATCH] Wrap text attachments Israel Herraiz
@ 2008-11-04 13:29 ` Nicolas Pouillard
  2008-11-04 14:07   ` Israel Herraiz
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Pouillard @ 2008-11-04 13:29 UTC (permalink / raw)


Excerpts from Israel Herraiz's message of Tue Nov 04 01:08:41 +0100 2008:
> Hi,

Hi,

> this patch wrap text attachaments, as well as messages. For me is
> quite annoying to have to scroll to see the text attachments. Perhaps
> it is useful for others too.

I have no opinion about this change.

However there is already a WRAP_LEN constant in this file, please provide
a patch that reuse the same constant.

Best regards,

> ---
>  lib/sup/message-chunks.rb |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
> index cc895f3..99bd12b 100644
> --- a/lib/sup/message-chunks.rb
> +++ b/lib/sup/message-chunks.rb
> @@ -65,6 +65,8 @@ Return value:
>  EOS
>  #' stupid ruby-mode
>  
> +    WRAP_LEN = 80 # wrap text attachments at this width
> +
>      ## raw_content is the post-MIME-decode content. this is used for
>      ## saving the attachment to disk.
>      attr_reader :content_type, :filename, :lines, :raw_content
> @@ -95,6 +97,7 @@ EOS
>        @lines = nil
>        if text
>          @lines = text.gsub("\r\n", "\n").gsub(/\t/, "        ").gsub(/\r/, "").split("\n")
> +        @lines = lines.map {|l| l.chomp.wrap WRAP_LEN}.flatten
>          @quotable = true
>        end
>      end

-- 
Nicolas Pouillard aka Ertai


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

* [sup-talk] [PATCH] Wrap text attachments
  2008-11-04 13:29 ` Nicolas Pouillard
@ 2008-11-04 14:07   ` Israel Herraiz
  2008-11-07 16:55     ` William Morgan
  0 siblings, 1 reply; 4+ messages in thread
From: Israel Herraiz @ 2008-11-04 14:07 UTC (permalink / raw)


Excerpts from Nicolas's message on Nov  4, 2008 about  2 PM:
> However there is already a WRAP_LEN constant in this file, please provide
> a patch that reuse the same constant.

Find it below. I have moved the constant out of the Attachment and
Text classes, and it is now in the context of the Chunk module.

Cheers,
Israel


---
 lib/sup/message-chunks.rb |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index cc895f3..5b5c314 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -41,6 +41,8 @@ end
 
 module Redwood
 module Chunk
+  WRAP_LEN = 80 # wrap messages and text attachments at this width
+
   class Attachment
     HookManager.register "mime-decode", <<EOS
 Executes when decoding a MIME attachment.
@@ -95,6 +97,7 @@ EOS
       @lines = nil
       if text
         @lines = text.gsub("\r\n", "\n").gsub(/\t/, "        ").gsub(/\r/, "").split("\n")
+        @lines = lines.map {|l| l.chomp.wrap WRAP_LEN}.flatten
         @quotable = true
       end
     end
@@ -143,7 +146,6 @@ EOS
   end
 
   class Text
-    WRAP_LEN = 80 # wrap at this width
 
     attr_reader :lines
     def initialize lines
-- 
1.5.6.5


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

* [sup-talk] [PATCH] Wrap text attachments
  2008-11-04 14:07   ` Israel Herraiz
@ 2008-11-07 16:55     ` William Morgan
  0 siblings, 0 replies; 4+ messages in thread
From: William Morgan @ 2008-11-07 16:55 UTC (permalink / raw)


Reformatted excerpts from israel.herraiz's message of 2008-11-04:
> Find it below. I have moved the constant out of the Attachment and
> Text classes, and it is now in the context of the Chunk module.

Applied, thanks!
-- 
William <wmorgan-sup at masanjin.net>


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

end of thread, other threads:[~2008-11-07 16:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-04  0:08 [sup-talk] [PATCH] Wrap text attachments Israel Herraiz
2008-11-04 13:29 ` Nicolas Pouillard
2008-11-04 14:07   ` Israel Herraiz
2008-11-07 16:55     ` William Morgan

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