From: "Shot (Piotr Szotkowski)" Date: 2008-11-24T02:30:59+09:00 Subject: Re: Printing right arrow vs. a sane progressbar library --u3/rZRmxL6MmkK24 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Rob Biedenharn: > On Nov 22, 2008, at 8:18 PM, Shot (Piotr Szotkowski) wrote: >> I want to track the progress of a set of >> (forkoff=E2=80=99d) processes in a simple way. [=E2=80=A6] >> print '.' * 25; (0...25).sort_by{rand}.each { |n| print "\r"; print "\c[= [C" * n; print 'o'; sleep 0.5 }; print "\n" > status=3D'.'*25; print status; (0...25).sort_by{rand}.each{|n| status[n]= =3D'o';=20 > print "\r#{status}"; sleep(0.1+rand/10.0)};puts A very good idea, but unfortunately it doesn=E2=80=99t work in a forkoff=E2= =80=99d block; every block gets its own copy of the original status and so generates a line with 24 dots and one o: shot@devielle:~$ irb -rubygems >> require 'forkoff' =3D> true >> status=3D'.'*25; print status; (0...25).sort_by{rand}.forkoff{|n| status= [n]=3D'o'; print "\r#{status}"; sleep(0.1+rand/10.0)};puts =2E.................o...... =3D> nil Hence my need for a right arrow, or for printing a =E2=80=98transparent=E2= =80=99 character that doesn=E2=80=99t overwrite what=E2=80=99s already under the c= ursor. > You could, perhaps, add a clear-to-EOL sequence, too. I=E2=80=99m sorry, but I=E2=80=99m a bit braindead today; where would I wan= t to use this? (And, when we=E2=80=99re at it, what=E2=80=99s the escape sentence fo= r it?) Thanks a lot for your interest in this thread and your reply! -- Shot --=20 A distributed system is one in which I cannot get something done because a machine I've never heard of is down. -- Leslie Lamport --u3/rZRmxL6MmkK24 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFJKZXDi/mCfdEo8UoRAnK+AJ0c786HnPDfkv8EA+BwApiruZ8+ywCdF4EN TU6Vmwel8K6NYabfuCElti4= =pQSr -----END PGP SIGNATURE----- --u3/rZRmxL6MmkK24--