changeset 45707:28170236270a

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
author rfield
date Sun, 25 Jun 2017 13:35:08 -0700
parents 7c61424b94ae
children 3512073b446f
files jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 {