Skip to content

Fix console input cursor not repositioning after output - #2849

Open
SougandhS wants to merge 1 commit into
eclipse-platform:masterfrom
SougandhS:ConsoleCursorFix
Open

Fix console input cursor not repositioning after output#2849
SougandhS wants to merge 1 commit into
eclipse-platform:masterfrom
SougandhS:ConsoleCursorFix

Conversation

@SougandhS

@SougandhS SougandhS commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Added repositionCaretAfterOutput() to IOConsoleViewer to move the caret to the next writable input partition whenever output is written.
Before :
bfr

After :
dff

Fixes : #2127

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Test Results

    54 files  ±0      54 suites  ±0   1h 0m 22s ⏱️ + 2m 8s
 4 705 tests +2   4 680 ✅ ±0   22 💤 ±0  3 ❌ +2 
12 006 runs  +3  11 850 ✅ +1  153 💤 ±0  3 ❌ +2 

For more details on these failures, see this check.

Results for commit 0593ec6. ± Comparison against base commit 7beef1c.

♻️ This comment has been updated with latest results.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Eclipse console usability by ensuring the input caret is repositioned to the next writable input partition after program output is written, aligning behavior with expectations described in issue #2127.

Changes:

  • Added repositionCaretAfterOutput() to IOConsoleViewer to move the caret to the next writable input partition.
  • Invoked caret repositioning after auto-scroll reveals the end of the document on document change events.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@SougandhS
SougandhS force-pushed the ConsoleCursorFix branch 2 times, most recently from 8d4fd59 to 576aed1 Compare August 4, 2026 01:13
@iloveeclipse

Copy link
Copy Markdown
Member

OK, looks good from the code point of view, tested with this snippet:

public class PrintAndRead {
    public static void main(String[] args) {
    	java.util.Scanner scanner = new java.util.Scanner(System.in);
        while (true) {
            System.out.print("Please type something: ");
            String input = scanner.nextLine();
            System.out.println("You typed: " + input);
        }
    }
}

Could you please add a test for this fix?

Added repositionCaretAfterOutput() to IOConsoleViewer to move the caret
to the next writable input partition whenever output is written.

Fixes : eclipse-platform#2127
@SougandhS

SougandhS commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Could you please add a test for this fix?

Added,
The failures looks unrelated - Passing on local

@iloveeclipse

Copy link
Copy Markdown
Member

Hmm. The failing tests are all about "not yet closed/disposed" consoles, interestingly they are all different and failing in different OS. The common thing is that some console is still "alive" and not closed.

the zoom font must be disposed once its console is removed ==> expected: <true> but was: <false>
org.opentest4j.AssertionFailedError: the zoom font must be disposed once its console is removed ==> expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
	at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:214)
	at org.eclipse.debug.tests.console.ConsoleTests.testRemovingConsoleDisposesZoomFont(ConsoleTests.java:472)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Console close was not signaled. ==> expected: <true> but was: <false>
org.opentest4j.AssertionFailedError: Console close was not signaled. ==> expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
	at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:214)
	at org.eclipse.debug.tests.console.IOConsoleTests.closeConsole(IOConsoleTests.java:211)
	at org.eclipse.debug.tests.console.IOConsoleTests.testConsoleClear(IOConsoleTests.java:258)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
[console has been added] 
Expected size: 1 but was: 2 in:
[Console [Test clear], Console [MockProcess]]
java.lang.AssertionError: 
[console has been added] 
Expected size: 1 but was: 2 in:
[Console [Test clear], Console [MockProcess]]
	at org.eclipse.debug.tests.console.ProcessConsoleManagerTests.testProcessConsoleLifecycle(ProcessConsoleManagerTests.java:88)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants