Closed sdht0 closed 7 years ago
You don't have to call lineReader.getHistory().save()
explicitely. The default behavior is controlled by the LineReader.Option.HISTORY_INCREMENTAL
option which is on by default, and when on, will automatically save the history when an item is added, which is done by the reader.
I'll fix the index issue which is the problem you actually report.
Hi,
JLine version:
compile 'org.jline:jline:3.3.1'
I have enabled history using:
and then executing
lineReader.getHistory().save()
in the main loop after each input. The HISTORY_FILE_SIZE value of 2 is to test truncation.The issue is, whenever the file is truncated, the history stops working in the terminal (up arrow does not fill in the earlier commands). It might be a configuration bug on my end, as I hacked this together by reading the interfaces (the wiki entry for history is still incomplete).
Kindly take a look.