8166744: JShell: java.lang.IndexOutOfBoundsException for legal history access
Reviewed-by: rfield, jlahoda
--- a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java Wed Sep 28 22:13:14 2016 +0530
+++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java Thu Sep 29 17:36:26 2016 +0900
@@ -48,7 +48,9 @@
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));