eclipse.platform icon indicating copy to clipboard operation
eclipse.platform copied to clipboard

Console input cursor does not reposition correctly after invalid input in Java program

Open abhigithb opened this issue 4 months ago • 0 comments

Description:

When running a Java program in Eclipse IDE that uses Scanner.nextLine() for user input, the console fails to reposition the input cursor correctly after an exception or invalid input. Even though the program prints a new prompt using System.out.println("Enter a number:"), the cursor remains stuck on the previous line (next to the error message), requiring manual mouse interaction to continue typing.

NOTE: This issue does not occur in IntelliJ IDEA, where the input cursor automatically moves to the correct line after each prompt.

Steps to Reproduce:

1)Create a Java program that reads user input using Scanner.nextLine().

2)Wrap the input logic in a loop with exception handling.

3)Run the program in Eclipse IDE.

4)Enter an invalid input (e.g., non-numeric string).

5)Observe the cursor position.

Actual Behavior: The cursor stays stuck with the error message, and the user must manually click to reposition it.

Expected Behavior: The input cursor should automatically move to the next line after printing the prompt, allowing the user to type without clicking.

IDE Configuration :

Eclipse IDE for Java Developers (includes Incubating components) Version: 2023-06 (4.28.0) Build id: 20230608-1333

https://github.com/user-attachments/assets/5527e445-c449-4c30-bc70-b0c7fc031972

BestFitTypeWithPrecision.java

abhigithb avatar Aug 23 '25 15:08 abhigithb