RFR: 8133549: Generalize jshell's EditingHistory

Jan Lahoda jan.lahoda at oracle.com
Thu May 12 10:25:09 UTC 2016


Hello,

In jshell, there's a special history mode that is intended to aid with 
editing/re-entering multi-line snippets (EditingHistory). It works like 
this: when the user goes back through the history to the first line of a 
multi-line snippet, and enters/confirms that line, the history view is 
limited only to the given snippet. I.e. up and down arrows won't go 
through the whole history, but only the few lines of the given snippet. 
When the multi-line snippet is finished, the history is restored to the 
original full state.

The proposal here is to generalize this history mode so that it can be 
used in jjs as well. For this, a new support class is added into 
jdk.internal.le, that implements this history. Also, ConsoleReader is 
extended to also accept actions as a Runnable instead of only 
ActionListener, so that the EditingHistory can add extra actions to jump 
by the whole snippets when going back in history.

Bug:
https://bugs.openjdk.java.net/browse/JDK-8133549

Webrev:
jdk repository:
http://cr.openjdk.java.net/~jlahoda/8133549/jdk/webrev.00/

langtools repository:
http://cr.openjdk.java.net/~jlahoda/8133549/langtools/webrev.00/

nashorn repository:
http://cr.openjdk.java.net/~jlahoda/8133549/nashorn/webrev.00/

Any comments are welcome!

Thanks,
     Jan



More information about the core-libs-dev mailing list