Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get carriage return without line feed effect in Eclipse console?

If I

System.out.print("something\r");

at console, I have cursor back at the beginning of line, and finally after

System.out.print("something\r");
System.out.print(" any\r");

I have

 anything

typed.

But at Eclipse console I get

something
 anything

as if it treated \r as CR/LF.

How can I setup this?

like image 426
Dims Avatar asked Feb 09 '13 22:02

Dims


People also ask

How do I get full console output in Eclipse?

It can be changed by going to Windows --> Preferences --> Run/Debug --> Console and then unchecking "Limit Console Output" which is ON by default. This works on STS any version too. This would help printing complete console output. For a Mac it is Eclipse > Preferences > Run/Debug > Console.

Is line feed the same as carriage return?

A line feed means moving one line forward. The code is \n . A carriage return means moving the cursor to the beginning of the line.

How do I fix the console in Eclipse?

Just open the Window(in eclipse IDE) -> click on Reset Perspective. It worked for me.


2 Answers

As Nishant already pointed out in the comments, you've found a bug here.

This bug initially was reported in 2004 (>9 years ago!?!!) and this bug seems not to be fixed very soon (or ever). I tested it on several Eclipse version, even on Eclipse Juno SR2, and the bug is still there.

like image 147
poitroae Avatar answered Oct 16 '22 22:10

poitroae


The bug is fixed by now (Eclipse 2020-03). Just go to

Window ➺ Preferences ➺ Run/Debug ➺ Console

and make sure that both checkboxes

Interpret ASCII control characters

and

Interpret Carriage Return (\r) as control character

are enabled.

like image 11
John McClane Avatar answered Oct 16 '22 23:10

John McClane