Mark Alexander
2009-May-23 18:19 UTC
[sup-talk] [PATCH] Use terminal width instead of hardcoded 80 as the wrap length.
---
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
Ben Walton
2009-May-23 19:23 UTC
[sup-talk] [PATCH] Use terminal width instead of hardcoded 80 as the wrap length.
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>
Ben Walton
2009-May-24 00:00 UTC
[sup-talk] [PATCH] Use terminal width instead of hardcoded 80 as the wrap length.
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 -- 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/6fdee8b1/attachment.bin>
William Morgan
2009-May-27 15:58 UTC
[sup-talk] [PATCH] Use terminal width instead of hardcoded 80 as the wrap length.
Reformatted excerpts from Ben Walton''s message of 2009-05-23:> 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.)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>
Ben Walton
2009-May-27 16:05 UTC
[sup-talk] [PATCH] Use terminal width instead of hardcoded 80 as the wrap length.
Excerpts from William Morgan''s message of Wed May 27 11:58:23 -0400 2009:> 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?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 -- 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/20090527/4914d9ff/attachment.bin>
Mark Alexander
2009-May-27 16:13 UTC
[sup-talk] [PATCH] Use terminal width instead of hardcoded 80 as the wrap length.
On Wed, May 27, 2009 at 8:58 AM, William Morgan <wmorgan-sup at masanjin.net> wrote:> Would a three-way toggle irritate anyone?Sounds good to me.
Nicolas Pouillard
2009-May-27 17:43 UTC
[sup-talk] [PATCH] Use terminal width instead of hardcoded 80 as the wrap length.
Excerpts from Mark Alexander''s message of Wed May 27 18:13:30 +0200 2009:> On Wed, May 27, 2009 at 8:58 AM, William Morgan > <wmorgan-sup at masanjin.net> wrote: > > Would a three-way toggle irritate anyone? > > Sounds good to me.It would also fit my needs. -- Nicolas Pouillard http://nicolaspouillard.fr
Ingmar Vanhassel
2009-Jun-06 00:35 UTC
[sup-talk] [PATCH] Use terminal width instead of hardcoded 80 as the wrap length.
Excerpts from William Morgan''s message of Wed May 27 17:58:23 +0200 2009:> Reformatted excerpts from Ben Walton''s message of 2009-05-23: > > 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.) > > 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?Works for me.
William Morgan
2009-Jun-12 19:29 UTC
[sup-talk] [PATCH] Use terminal width instead of hardcoded 80 as the wrap length.
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>