Lakshman Subramanya wrote:I figured out \r and \b behaves incorrectly when the program is ran through Eclipse IDE and its console on Mac OSX. It works fine when I run it through Mac Terminal app (command line).
My worry here is that your program is likely to be very platform-specific. Indeed, yours is likely to become
terminal-specific, which is arguably even worse.
The problem is that you may be able to emulate the overlay characteristics you want, but
cursor placement is another thing completely. For example, on many terminals '\b' may NOT necessarily be destructive, so
System.out.println("Hexagon\tOcta\b\b\b");
might well produce:
Hexagon Octa
(the underline shows where the cursor will be),
and
System.out.println("Hexagon\tOcta\b\b\bX");
something like:
Hexagon OXta
My point is that either:
(a)
You need to decide what the display rules are.
(b) You need to choose a terminal that does what you want
and document it in your program.
HIH
Winston