jline / jline3

JLine is a Java library for handling console input.
Other
1.49k stars 218 forks source link

Cannot call Widget #183

Closed Exceptionflug closed 7 years ago

Exceptionflug commented 7 years ago

Exception in thread "main" java.lang.IllegalStateException at org.jline.reader.impl.LineReaderImpl.callWidget(LineReaderImpl.java:651) at de.dawnstudios.nnxcloud.main.Main.launch(Main.java:112) at de.dawnstudios.nnxcloud.main.Main.main(Main.java:40) Main.java:112 is java reader.callWidget(LineReader.CLEAR_SCREEN); reader is of course a LineReader

gnodet commented 7 years ago

The callWidget method can only be called while the reader is inside a readLine call. If that's not the case and you want to clear the screen, just use

reader.getTerminal().puts(Capability.clear_screen);
reader.getTerminal().flush();