Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: rick.tessner <rick.tessner@gmail.com>
To: sup-talk <sup-talk@rubyforge.org>
Subject: Re: [sup-talk] Sup-sync exception
Date: Fri, 06 Nov 2009 07:13:19 -0800	[thread overview]
Message-ID: <1257520288-sup-8595@onnadayr.ca> (raw)
In-Reply-To: <1257452860-sup-7983@testarossa>

[-- Attachment #1: Type: text/plain, Size: 892 bytes --]

Hi,

Excerpts from Mark Anderson's message of Thu Nov 05 12:29:23 -0800 2009:
> 
> I have an offlineimap synced IMAP Maildir area, and for some reason I get an error when I try to run
> sup-sync.

I had that exact same thing.  If you applied a patch that used
Ncurses.cols rather than WRAP_LEN to determine screen width, you'll have
that problem in the non-curses based sup applications.

The patch came from an email with the subject

    [PATCH] Use terminal width instead of hardcoded 80 as the wrap length.

I initially didn't have any problems whatsoever with that patch until I ran
sup-sync. I fixed it with the attached commit.

This patch just does a rescue on that call.  The patch is only
applicable if you had applied a patch that came through previously on
this list for using Ncurses.cols rather than WRAP_LEN in
lib/sup/message-chunks.rb
-- 
Rick Tessner
rick.tessner@gmail.com

[-- Attachment #2: 0001-Corrects-Use-terminal-width-instead-of-hardcoded-80-.patch --]
[-- Type: application/octet-stream, Size: 1637 bytes --]

From 71047a972968dd6fae0b760b400ea05438993fef Mon Sep 17 00:00:00 2001
From: Rick Tessner <rick@onnadayr.ca>
Date: Thu, 15 Oct 2009 12:55:27 -0700
Subject: [PATCH] Corrects "Use terminal width instead of hardcoded 80 as the wrap length."

This corrects commit f0c7e30dec3e18b0ff59dff28c741422e5f7d10e.
---
 lib/sup/message-chunks.rb |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index a74b442..f19c8fe 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -41,6 +41,7 @@ end
 
 module Redwood
 module Chunk
+  WRAP_LEN = 80 # wrap messages and text attachments at this width
 
   class Attachment
     HookManager.register "mime-decode", <<EOS
@@ -108,8 +109,9 @@ EOS
 
       @lines = nil
       if text
+        wrap_len = Ncurses.cols rescue WRAP_LEN  # Ncurses fails in sup-sync & friends ...
         @lines = text.gsub("\r\n", "\n").gsub(/\t/, "        ").gsub(/\r/, "").split("\n")
-        @lines = lines.map {|l| l.chomp.wrap Ncurses.cols}.flatten
+        @lines = lines.map {|l| l.chomp.wrap wrap_len}.flatten
         @quotable = true
       end
     end
@@ -161,7 +163,8 @@ EOS
 
     attr_reader :lines
     def initialize lines
-      @lines = lines.map { |l| l.chomp.wrap Ncurses.cols }.flatten # wrap
+      wrap_len = Ncurses.cols rescue WRAP_LEN  # Ncurses fails in sup-sync & friends ...
+      @lines = lines.map { |l| l.chomp.wrap wrap_len }.flatten # wrap
 
       ## trim off all empty lines except one
       @lines.pop while @lines.length > 1 && @lines[-1] =~ /^\s*$/ && @lines[-2] =~ /^\s*$/
-- 
1.6.3


[-- Attachment #3: Type: text/plain, Size: 140 bytes --]

_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

  reply	other threads:[~2009-11-06 15:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-05 20:29 Mark Anderson
2009-11-06 15:13 ` rick.tessner [this message]
2009-11-06 20:06   ` Mark Anderson
2009-11-07  2:16     ` Anthony Martinez
2009-11-07  4:10       ` Mark Alexander
2009-11-20 15:50 Ned Ludd
2009-11-21  5:18 ` Andrei Thorp
2009-11-23 23:33 ` 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=1257520288-sup-8595@onnadayr.ca \
    --to=rick.tessner@gmail.com \
    --cc=sup-talk@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