8166744: JShell: java.lang.IndexOutOfBoundsException for legal history access

Reviewed-by: rfield, jlahoda
This commit is contained in:
Shinya Yoshida 2016-09-29 17:36:26 +09:00
parent 323aded97f
commit c34cee90d8

View File

@ -48,7 +48,9 @@ public abstract class EditingHistory implements History {
private History currentDelegate;
protected EditingHistory(ConsoleReader in, Iterable<? extends String> originalHistory) {
this.fullHistory = new MemoryHistory();
MemoryHistory fullHistory = new MemoryHistory();
fullHistory.setIgnoreDuplicates(false);
this.fullHistory = fullHistory;
this.currentDelegate = fullHistory;
bind(in, CTRL_UP,
(Runnable) () -> moveHistoryToSnippet(in, ((EditingHistory) in.getHistory())::previousSnippet));