8182854: jshell tool: rerun multiline snippet from history corrupts history (jdk part)
authorrfield
Sun, 25 Jun 2017 13:35:08 -0700
changeset 45707 28170236270a
parent 45706 7c61424b94ae
child 45708 3512073b446f
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
jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java
--- 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 {