From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1736 invoked from network); 2 Mar 2005 18:20:54 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 2 Mar 2005 18:20:54 -0000 Received: (qmail 30426 invoked from network); 2 Mar 2005 18:20:48 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 2 Mar 2005 18:20:48 -0000 Received: (qmail 29447 invoked by alias); 2 Mar 2005 18:20:45 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20913 Received: (qmail 29433 invoked from network); 2 Mar 2005 18:20:44 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 2 Mar 2005 18:20:44 -0000 Received: (qmail 30144 invoked from network); 2 Mar 2005 18:20:41 -0000 Received: from vms044pub.verizon.net (206.46.252.44) by a.mx.sunsite.dk with SMTP; 2 Mar 2005 18:20:37 -0000 Received: from candle.brasslantern.com ([4.11.1.68]) by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0ICQ009I5LM9LED0@vms044.mailsrvcs.net> for zsh-workers@sunsite.dk; Wed, 02 Mar 2005 12:20:34 -0600 (CST) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id j22IKW9U029880 for ; Wed, 02 Mar 2005 10:20:32 -0800 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j22IKVhS029879 for zsh-workers@sunsite.dk; Wed, 02 Mar 2005 10:20:32 -0800 Date: Wed, 02 Mar 2005 18:20:31 +0000 From: Bart Schaefer Subject: Re: Bug in echotc ? In-reply-to: <20050302161048.GA12461@scowler.net> To: zsh-workers@sunsite.dk Message-id: <1050302182031.ZM29878@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=us-ascii References: <1050302091036.ZM29038@candle.brasslantern.com> <20050302150800.GA10579@scowler.net> <20050302161048.GA12461@scowler.net> Comments: In reply to Clint Adams "Re: Bug in echotc ?" (Mar 2, 11:10am) X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 On Mar 2, 11:10am, Clint Adams wrote: } Subject: Re: Bug in echotc ? } } > echotc is broken. I think it's still broken after this patch. } } This is probably a bit more appropriate. } } else { } + /* This assumes arguments of for cap 'cm' */ } num = (argv[1]) ? atoi(argv[1]) : atoi(*argv); } - tputs(tgoto(t, num, atoi(*argv)), num, putraw); } + tputs(tgoto(t, num, atoi(*argv)), 1, putraw); } } Hmm. The tputs routine applies padding information to the string str and outputs it. The str must be a terminfo string variable or the return value from tparm, tgetstr, or tgoto. affcnt is the number of lines affected, or 1 if not applicable. putc is a putchar-like routine to which the characters are passed, one at a time. So it seems like what we really want is more like num = atoi(*argv); t = tgoto(t, (argv[1] ? atoi(argv[1]) : num), num); tputs(t, num, putraw); Because atoi(*argv) is "the number of lines affected". Except it isn't, quite, because really the number of lines affected is the difference between the current line and the target line. So maybe 1 is the right value to use for the second argument of tputs() after all. Except if this isn't a "cm" but rather a relative line-motion such as "DO" or "UP" then ... maybe what we want is num = atoi(*argv); if (argct == 1) tputs(tgoto(t, num, num), num, putraw); else tputs(tgoto(t, atoi(argv[1]), num), 1, putraw); Except it's not clear *that* does the right thing with "LE" or "RI". Gag.