Menu

#58 Call to readLine doesn't display existing buffer contents

open
nobody
None
5
2010-05-12
2010-05-12
No

The buffer used by each ConsoleReader is a separate object from the ConsoleReader. It's possible to escape from a call to readLine and then start a second call. The contents of the buffer remain from the first call, but aren't currently displayed. One simple fix is to have readLine display the prompt and then the cursor and buffer as they are saved. A better fix is to design a fancier interface between callers and jline, say by having one method that clears the buffer and another that doesn't.

Incidentally, it is very useful to be able to preset the buffer. Callers of jline may want to initialize some contents. Or they may simply know that the existing buffer needs to be redisplayed for some reason. The "fix" of always clearing the buffer before any line-reading operation would create an artificially limiting design.

Discussion


Log in to post a comment.