Using JLine (or JLine2), is it possible to call readline on the ConsoleReader and have, in addition to the standard request, a buffer pre-filled with a line of my choice?
I tried to do, for example:
reader.getCursorBuffer().write("Default"); reader.readLine("Prompt> ");
This seems to be actually written to the buffer, but the prompt only displays in the line. If I press enter, readline returns "Default" , as expected. If I clear the screen, the buffer is redrawn and displayed correctly.
I understand that I need to somehow call reader.redrawLine() right after calling readline . The latter, however, blocks, which makes it difficult (not impossible, but, of course, it is wrong to use the second thread for this).
source share