You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed some strange behaviour when trying to clear the screen.
Attempts to clear the screen do not work with usual method of System.out.print("\u001b[2J"). Furthermore, when ConsoleReader.clearScreen is used, the screen WILL clear, BUT a double command prompt (--+--> --+-->) appears!
Example (swap con.clearScreen and System.out... to see both 'features'):
classTestJline {
privatestaticfinalStringERASE_DISPLAY = "\u001b[2J";
publicstaticvoidmain (Stringargv[]) {
try {
ConsoleReadercon = newConsoleReader();
con.setPrompt("--+--> ");
System.out.print(ERASE_DISPLAY);
System.out.println("Press any key to continue...");
con.readCharacter();
//con.clearScreen();System.out.print(ERASE_DISPLAY);
System.out.println("Here is a prompt. Do something and press enter to continue...");
Stringline = con.readLine();
//con.clearScreen();System.out.print(ERASE_DISPLAY);
System.out.println("You typed: ");
System.out.println(line);
System.out.println("Press any key to exit. ");
con.readCharacter();
//con.clearScreen();System.out.print(ERASE_DISPLAY);
System.out.println("Thank You. Goodbye.");
System.out.println("");
} catch(IOExceptione) {
//What to do in the event of an IOException:e.printStackTrace();
} finally {
try {
TerminalFactory.get().restore();
} catch(Exceptione) {
e.printStackTrace();
}
}
}
The text was updated successfully, but these errors were encountered:
JDurston
changed the title
Strange behaviour surrounding clear screen and ConsoleReader.clearScreen
Strange behaviour surrounding clear screen and ConsoleReader.clearScreen()
Nov 14, 2015
Linux x86-64; Ubuntu; Terminal; zsh
I noticed some strange behaviour when trying to clear the screen.
Attempts to clear the screen do not work with usual method of
System.out.print("\u001b[2J")
.Furthermore, when
ConsoleReader.clearScreen
is used, the screen WILL clear, BUT a double command prompt (--+--> --+-->
) appears!Example (swap
con.clearScreen
andSystem.out...
to see both 'features'):The text was updated successfully, but these errors were encountered: