- Subject: Re: Line numbers and Visible Tabs
- From: Günter Milde <milde@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 3 Jun 2003 17:45:00 +0200
On Mon, Jun 02, 2003 at 06:33:29PM +0000, Joerg Sommer wrote:
> begin Günter Milde <milde@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> Könnte man hier nicht gemeiner Weise auch schreiben:
>
> variable i = 1, digits = string( strlen(string(what_line()) ));
...
> insert(sprintf("%"+digits+"d", i));
Your are perfectly right. I modified your proposal a bit, so the
format-string is concatenated only once and not with every insertion:
public define number_lines ()
{
push_spot;
if(is_visible_mark, dup) % leave return-value on stack
narrow;
eob;
variable i = 1,
format = "%"+string(strlen(string(what_line())))+"d ";
bob;
do
{ bol;
insert(sprintf(format, i));
i++;
}
while (down_1);
if (()) % was_visible_mark
widen;
pop_spot;
}
Works for me.
Günter
--
Milde at ife.et.tu-dresden.de
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2003 date index]
[2003 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]