Hello, folks.
I’m trying to write simple CLI program which will be some kind of
chat, but i have faced with some output problem.
Is it possible to output over current line in stdout?
User types something in prompt> and at this moment message from
another user arrives. Currently, I’m using readline, and if i just
<puts “\n#{user}: #{message}\n”> I’ll end with following
screen 2:
$ ./chat.rb
prompt> hello, peo <-he was typing
UserA: Ruby is cool!!!1111
So, my goal is output “UserA…” over my prompt>, to not confuse user
and do not make him retype everything on every event.
$ ./chat.rb
UserA: Ruby is cool!!!1111
prompt> hello, peo <-he is still typing…
Thanks for any help.