Subject: [sup-talk] [PATCH] Use terminal width instead of hardcoded 80 as the wrap length.

From: [email-masked] (Mark Alexander)
Date: Sat, 23 May 2009 11:19:03 -0700

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

---

From: [email-masked] (Ben Walton)
Date: Sat, 23 May 2009 15:23:23 -0400

Excerpts from Mark Alexander's message of Sat May 23 14:19:03 -0400 2009:

+1 to this also.

-Ben
-- 
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302

GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
Contact me to arrange for a CAcert assurance meeting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090523/1c908b26/attachment.bin>

---

From: [email-masked] (Ben Walton)
Date: Sat, 23 May 2009 20:00:54 -0400

Excerpts from Michael Stipicevic's message of Sat May 23 16:18:03 -0400 2009:
> I don't know, reading little e-mails on a widescreen monitor gets really
> annoying. Forcing 80 columns keeps it easier on the eyes. Could this be put
> into an option somehow?

But if you leave sup's "we dont' force wrapping" rules alone, this
makes reading mail scroll free if your terminal is wide enough and
doesn't change the behaviour if the terminal is narrower.  (Not that
I'm against making it an option either.)

-Ben

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090523/6fdee8b1/attachment.bin>

---

From: [email-masked] (William Morgan)
Date: Wed, 27 May 2009 08:58:23 -0700

> I'm against making it an option either.)

Seems like there are three main modes of operation that would be
desirable:

1. wrap at 80 chars;
2. wrap at current terminal width;
3. don't wrap.

(In all cases, existing line breaks in the message are left alone.)

Would a three-way toggle irritate anyone?
-- 
William <wmorgan-sup at masanjin.net>

---

From: [email-masked] (Ben Walton)
Date: Wed, 27 May 2009 12:05:09 -0400

> Would a three-way toggle irritate anyone?

Yes, for the message itself, this would work just fine.  I'm ok with
the toggle too.

For the header display though, the terminal width should be honoured,
I think.

Thanks
-Ben

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090527/4914d9ff/attachment.bin>

---

From: [email-masked] (Mark Alexander)
Date: Wed, 27 May 2009 09:13:30 -0700

On Wed, May 27, 2009 at 8:58 AM, William Morgan
> Would a three-way toggle irritate anyone?

Sounds good to me.

---

From: [email-masked] (Nicolas Pouillard)
Date: Wed, 27 May 2009 19:43:11 +0200

> > Would a three-way toggle irritate anyone?

It would also fit my needs.

-- 
Nicolas Pouillard
http://nicolaspouillard.fr

---

From: [email-masked] (Ingmar Vanhassel)
Date: Sat, 06 Jun 2009 02:35:50 +0200

> Would a three-way toggle irritate anyone?

Works for me.

---

From: [email-masked] (William Morgan)
Date: Fri, 12 Jun 2009 12:29:46 -0700

Reformatted excerpts from Marc Hartstein's message of 2009-06-07:
> Do we currently honor format=flowed email?

No.

> If we don't, it would be desirable to take this into account when
> designing the display wrapping options, and it seems like it would be
> worth implementing down the road.

Yes, I suppose so.

> It might be useful to be able to specify the wrap margin to something
> other than 80.  I don't know if anybody would actually use this,
> though.

I will leave that kind of thing for the Sup GUI clients. :)
-- 
William <wmorgan-sup at masanjin.net>