8232856: jshell crashes when pressing up arrow after /!

Reviewed-by: psandoz
This commit is contained in:
Jan Lahoda 2020-11-05 09:12:07 +00:00
parent 700447f7e4
commit cdef186c11
2 changed files with 14 additions and 1 deletions

View File

@ -833,6 +833,7 @@ class ConsoleIOContext extends IOContext {
}
it.remove();
in.getHistory().add(source);
in.getHistory().resetIndex();
}
private static final long ESCAPE_TIMEOUT = 100;

View File

@ -23,7 +23,7 @@
/**
* @test
* @bug 8178077
* @bug 8178077 8232856
* @summary Check the UI behavior of editing history.
* @modules
* jdk.compiler/com.sun.tools.javac.api
@ -77,4 +77,16 @@ public class HistoryUITest extends UITesting {
});
}
public void testReRun() throws Exception {
doRunTest((inputSink, out) -> {
inputSink.write("System.err.println(\"RAN\");\n");
waitOutput(out, "RAN.*" + PROMPT);
inputSink.write("/!\n");
waitOutput(out, "RAN.*" + PROMPT);
inputSink.write(UP);
inputSink.write("\n");
waitOutput(out, "RAN.*" + PROMPT);
});
}
}