From: marka@pobox.com (Mark Alexander)
Subject: [sup-talk] [PATCH] Use terminal width instead of hardcoded 80 as the wrap length.
Date: Sat, 23 May 2009 11:19:03 -0700 [thread overview]
Message-ID: <1243102667-sup-6007@r50p> (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
next reply other threads:[~2009-05-23 18:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-23 18:19 Mark Alexander [this message]
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
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=1243102667-sup-6007@r50p \
--to=marka@pobox.com \
/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