From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.90.79.9 with SMTP id c9cs291854agb; Fri, 6 Nov 2009 18:16:53 -0800 (PST) Received: by 10.224.94.198 with SMTP id a6mr2810003qan.251.1257560212884; Fri, 06 Nov 2009 18:16:52 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 31si658308qyk.19.2009.11.06.18.16.52; Fri, 06 Nov 2009 18:16:52 -0800 (PST) Received-SPF: pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-talk-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 21D0B1D7886C; Fri, 6 Nov 2009 21:16:52 -0500 (EST) Received: from mail.cnsp.com (mail.cnsp.com [208.3.80.17]) by rubyforge.org (Postfix) with ESMTP id 8E76818582D0; Fri, 6 Nov 2009 21:16:44 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.cnsp.com (Postfix) with ESMTP id 88B52C24CE78; Fri, 6 Nov 2009 19:16:43 -0700 (MST) X-Virus-Scanned: Debian amavisd-new at cnsp.biz Received: from mail.cnsp.com ([127.0.0.1]) by localhost (mail.cnsp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Qmq6+snLWbpW; Fri, 6 Nov 2009 19:16:43 -0700 (MST) Received: from home.mrtheplague.net (coffeehost.tcct.nmt.edu [129.138.3.50]) by mail.cnsp.com (Postfix) with SMTP id 3A62FD448EE0; Fri, 6 Nov 2009 19:16:43 -0700 (MST) Received: by home.mrtheplague.net (Postfix, from userid 1000) id 5663484C78A3; Fri, 6 Nov 2009 19:16:42 -0700 (MST) From: Anthony Martinez X-modeline: vim:tw=80:ft=mail:fo=tcql To: sup-talk In-reply-to: <1257537789-sup-1961@testarossa> References: <1257452860-sup-7983@testarossa> <1257520288-sup-8595@onnadayr.ca> <1257537789-sup-1961@testarossa> Date: Fri, 06 Nov 2009 19:16:42 -0700 Message-Id: <1257556260-sup-1272@home.mrtheplague.net> User-Agent: Sup/git Cc: sup-devel Subject: Re: [sup-talk] Sup-sync exception X-BeenThere: sup-talk@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: User & developer discussion of Sup List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-talk-bounces@rubyforge.org Errors-To: sup-talk-bounces@rubyforge.org Excerpts from Mark Anderson's message of Fri Nov 06 13:06:17 -0700 2009: > There was another patch that is complementary in getting the console to > recognize the width of the terminal, I forget the tname, but here's what I > have in my message-chunks.rb: > > TERM_WIDTH = `stty size 2>/dev/null`.split[1].to_i # to_i returns 0 if it fails > WRAP_LEN = TERM_WIDTH > 0 && TERM_WIDTH || 80 # wrap messages and text attachments at this width > > I don't know why that patch preferred `stty` to ENV["COLUMNS"], since that one > had worked for me. That'd be my patch. I used stty because ENV["COLUMNS"] doesn't consistently work for me: $ echo $COLUMNS 132 $ perl -wE 'say $ENV{COLUMNS}' Use of uninitialized value in say at -e line 1. $ ruby -e 'puts ENV["COLUMNS"]' nil $ irb irb(main):001:0> ENV["COLUMNS"] => "132" In Sup's console mode, ENV["COLUMNS"] is set, but when I tried WRAP_LEN = ENV["COLUMNS"] in message-chunks.rb, it gets nil. It appears to have something to do with readline: $ irb --noreadline irb(main):001:0> ENV["COLUMNS"] => nil I also tried Ncurses.cols, as suggested on sup-devel, and got a similar exception to yours. `stty`, albeit cheesy, works well enough for right now (even though I'm not quite happy with it, since, in addition to its reliance on the output of an external command, it also won't react to window size changes) Perhaps this should be a configuration option -- give it a number to wrap to that width, :auto to wrap to the terminal size (in some fashion that will allow it to resize when the terminal does), and in the absence of any configuration, 80. -- Every program has at least one bug and can be shortened by at least one instruction -- from which, by induction, one can deduce that every program can be reduced to one instruction which doesn't work. _______________________________________________ sup-talk mailing list sup-talk@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-talk