EDIT: This feature only occurs when I invoke the
clearScreen
method of ConsoleReader
! Any other changes don't have an effect. Is this then a bug in JLine2?
JLine2:
Why, when I run this, do I get two console prompts directly following each other (----> ---->
)?
Is it because two consoles are being created? I do not understand how.
What am I failing to see here?
import java.io.IOException;
import jline.console.ConsoleReader;
class TextUi implements Ui {
private static final String prompt1 = "----> ";
public void homeScreen() {
try {
ConsoleReader con = new ConsoleReader();
con.setPrompt(prompt1);
con.clearScreen();
System.out.println("Press any key to continue...");
con.readCharacter();
con.clearScreen();
System.out.println("Here is a prompt. Do something and press enter to continue...");
String line = con.readLine();
con.clearScreen();
System.out.println("You typed: ");
System.out.println(line);
System.out.println("Press any key to exit. ");
con.readCharacter();
con.clearScreen();
} catch (IOException e) {
e.printStackTrace();
}
}
public void exitSplash() {
System.out.println("Thank You. Goodbye.");
System.out.println("");
}
public void creditsScreen() {
}
public static void main (String argv[]) {
TextUi ui = new TextUi();
ui.homeScreen();
ui.exitSplash();
}
}