Using either JLine (or JLine2), is it possible to issue a call to readline
on a ConsoleReader
and have, in addition to the standard prompt, the buffer be pre-filled with a string of my choosing?
I have tried to do, e.g.:
reader.getCursorBuffer().write("Default");
reader.readLine("Prompt> ");
This seems to indeed write into the buffer, but the line only displays the prompt. If I press enter, readLine
returns "Default"
as I would expect. If I clear the screen, the buffer is redrawn and shown correctly.
My understanding is that I should somehow call reader.redrawLine()
right after the call to readLine
. This last one however is blocking, which makes it hard (not impossible, but it certainly feels wrong to use a second thread for that).