From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Re: Bug in echotc ?
Date: Wed, 02 Mar 2005 18:20:31 +0000 [thread overview]
Message-ID: <1050302182031.ZM29878@candle.brasslantern.com> (raw)
In-Reply-To: <20050302161048.GA12461@scowler.net>
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 <lines> <columns> 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.
next prev parent reply other threads:[~2005-03-02 18:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-02 9:10 Bart Schaefer
2005-03-02 15:08 ` Clint Adams
2005-03-02 16:10 ` Clint Adams
2005-03-02 18:20 ` Bart Schaefer [this message]
2005-03-02 18:25 ` Clint Adams
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=1050302182031.ZM29878@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@sunsite.dk \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).