8182854: jshell tool: rerun multiline snippet from history corrupts history (jdk part)
Summary: jdk sub-repo part of fix for parent issue 8182489, test in parent commit (langtools)
Reviewed-by: jlahoda
--- a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java Sat Jun 24 02:59:17 2017 +0000
+++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java Sun Jun 25 13:35:08 2017 -0700
@@ -380,7 +380,10 @@
}
public void fullHistoryReplace(String source) {
- fullHistory.replace(source);
+ fullHistory.removeLast();
+ for (String line : source.split("\\R")) {
+ fullHistory.add(line);
+ }
}
private class NarrowingHistoryLine implements CharSequence {