Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] [PATCH] Use terminal width instead of hardcoded 80 as the wrap length.
@ 2009-05-23 18:19 Mark Alexander
  2009-05-23 19:23 ` Ben Walton
       [not found] ` <4c4248150905231318kab3819dw68e3a3a614241c0d@mail.gmail.com>
  0 siblings, 2 replies; 9+ messages in thread
From: Mark Alexander @ 2009-05-23 18:19 UTC (permalink / raw)


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

diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index 1bf7796..a463fd4 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -41,7 +41,6 @@ end
 
 module Redwood
 module Chunk
-  WRAP_LEN = 80 # wrap messages and text attachments at this width
 
   class Attachment
     HookManager.register "mime-decode", <<EOS
@@ -109,7 +108,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
+        @lines = lines.map {|l| l.chomp.wrap Ncurses.cols}.flatten
         @quotable = true
       end
     end
@@ -161,7 +160,7 @@ EOS
 
     attr_reader :lines
     def initialize lines
-      @lines = lines.map { |l| l.chomp.wrap WRAP_LEN }.flatten # wrap
+      @lines = lines.map { |l| l.chomp.wrap Ncurses.cols }.flatten # wrap
 
       ## trim off all empty lines except one
       @lines.pop while @lines.length > 1 && @lines[-1] =~ /^\s*$/ && @lines[-2] =~ /^\s*$/
-- 
1.5.6.3


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

end of thread, other threads:[~2009-06-12 19:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-23 18:19 [sup-talk] [PATCH] Use terminal width instead of hardcoded 80 as the wrap length Mark Alexander
2009-05-23 19:23 ` Ben Walton
     [not found] ` <4c4248150905231318kab3819dw68e3a3a614241c0d@mail.gmail.com>
2009-05-24  0:00   ` Ben Walton
2009-05-27 15:58     ` William Morgan
2009-05-27 16:05       ` Ben Walton
2009-05-27 16:13       ` Mark Alexander
2009-05-27 17:43         ` Nicolas Pouillard
2009-06-06  0:35       ` Ingmar Vanhassel
     [not found]       ` <1244392518-sup-9746@cabinet>
2009-06-12 19:29         ` William Morgan

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