Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH] Add config option to limit text wrapping width
@ 2010-02-03 20:16 Daniel Schoepe
  2010-02-27  8:32 ` Rich Lane
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Schoepe @ 2010-02-03 20:16 UTC (permalink / raw)
  To: sup-devel

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


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

* Re: [sup-devel] [PATCH] Add config option to limit text wrapping width
  2010-02-03 20:16 [sup-devel] [PATCH] Add config option to limit text wrapping width Daniel Schoepe
@ 2010-02-27  8:32 ` Rich Lane
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Lane @ 2010-02-27  8:32 UTC (permalink / raw)
  To: Daniel Schoepe; +Cc: sup-devel

Applied to master.
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


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

end of thread, other threads:[~2010-02-27  8:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-03 20:16 [sup-devel] [PATCH] Add config option to limit text wrapping width Daniel Schoepe
2010-02-27  8:32 ` Rich Lane

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