From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.90.79.9 with SMTP id c9cs72655agb; Tue, 3 Nov 2009 19:58:56 -0800 (PST) Received: by 10.224.87.87 with SMTP id v23mr490106qal.158.1257307135717; Tue, 03 Nov 2009 19:58:55 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 1si1053074qyk.36.2009.11.03.19.58.55; Tue, 03 Nov 2009 19:58:55 -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 71AF416782B5; Tue, 3 Nov 2009 22:58:55 -0500 (EST) Received: from mail.cnsp.com (mail.cnsp.com [208.3.80.17]) by rubyforge.org (Postfix) with ESMTP id EFD2418582BF; Tue, 3 Nov 2009 22:58:47 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.cnsp.com (Postfix) with ESMTP id 0DC03D469BBD; Tue, 3 Nov 2009 20:58:47 -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 EgtQs+NnA7Vu; Tue, 3 Nov 2009 20:58:46 -0700 (MST) Received: from home.mrtheplague.net (coffeehost.tcct.nmt.edu [129.138.3.50]) by mail.cnsp.com (Postfix) with SMTP id 3410BC254C9A; Tue, 3 Nov 2009 20:51:47 -0700 (MST) Received: by home.mrtheplague.net (Postfix, from userid 1000) id 5CF1984E2E60; Tue, 3 Nov 2009 20:51:46 -0700 (MST) From: Anthony Martinez X-modeline: vim:tw=80:ft=mail:fo=tcql To: sup-talk , sup-devel In-reply-to: <1257303919-30524-1-git-send-email-pi+sup@pihost.us> References: <1257303919-30524-1-git-send-email-pi+sup@pihost.us> Date: Tue, 03 Nov 2009 20:51:46 -0700 Message-Id: <1257306460-sup-1506@home.mrtheplague.net> User-Agent: Sup/git Subject: [sup-talk] [CORRECTED PATCH] If we can get the terminal width, use that for WRAP_LEN. 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 I find that this provides a much smoother terminal experience, especially with elinks configured to dump to the same size in hook scripts. At least on Linux, "stty size"'s second numerical output is the number of columns, and if that fails somehow, sup will continue to happily default to 80. --- lib/sup/message-chunks.rb | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb index 581b707..56ddf1e 100644 --- a/lib/sup/message-chunks.rb +++ b/lib/sup/message-chunks.rb @@ -41,7 +41,8 @@ end module Redwood module Chunk - WRAP_LEN = 80 # wrap messages and text attachments at this width + 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 class Attachment HookManager.register "mime-decode", <