Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug in echotc ?
- X-seq: zsh-workers 20913
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Bug in echotc ?
- Date: Wed, 02 Mar 2005 18:20:31 +0000
- In-reply-to: <20050302161048.GA12461@xxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <1050302091036.ZM29038@xxxxxxxxxxxxxxxxxxxxxxx> <20050302150800.GA10579@xxxxxxxxxxx> <20050302161048.GA12461@xxxxxxxxxxx>
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author