From: Daniel Schoepe <daniel.schoepe@googlemail.com>
To: sup-devel@rubyforge.org
Subject: [sup-devel] [PATCH] Add config option to limit text wrapping width
Date: Wed, 3 Feb 2010 21:16:35 +0100 [thread overview]
Message-ID: <1265228195-4063-1-git-send-email-daniel.schoepe@googlemail.com> (raw)
This patch adds a configuration `wrap_width' option to limit the width
text wrapping uses(e.g. to wrap after 80 characters).
---
lib/sup.rb | 3 ++-
lib/sup/modes/thread-view-mode.rb | 7 ++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/sup.rb b/lib/sup.rb
index b9dc749..df85636 100644
--- a/lib/sup.rb
+++ b/lib/sup.rb
@@ -263,7 +263,8 @@ else
:discard_snippets_from_encrypted_messages => false,
:default_attachment_save_dir => "",
:sent_source => "sup://sent",
- :poll_interval => 300
+ :poll_interval => 300,
+ :wrap_width => 0
}
begin
FileUtils.mkdir_p Redwood::BASE_DIR
diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
index 0e935a4..e109a2d 100644
--- a/lib/sup/modes/thread-view-mode.rb
+++ b/lib/sup/modes/thread-view-mode.rb
@@ -792,7 +792,12 @@ private
if chunk.inlineable?
lines = chunk.lines
if @wrap
- width = buffer.content_width
+ config_width = $config[:wrap_width]
+ if config_width and config_width != 0
+ width = [config_width, buffer.content_width].min
+ else
+ width = buffer.content_width
+ end
lines = lines.map { |l| l.chomp.wrap width }.flatten
end
lines.map { |line| [[chunk.color, "#{prefix}#{line}"]] }
--
1.6.6.1
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel
next reply other threads:[~2010-02-03 20:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-03 20:16 Daniel Schoepe [this message]
2010-02-27 8:32 ` Rich Lane
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=1265228195-4063-1-git-send-email-daniel.schoepe@googlemail.com \
--to=daniel.schoepe@googlemail.com \
--cc=sup-devel@rubyforge.org \
/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