From robert.field at oracle.com Tue Dec 4 22:59:02 2018 From: robert.field at oracle.com (Robert Field) Date: Tue, 4 Dec 2018 14:59:02 -0800 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <5C0054CF.3040009@oracle.com> References: <5C0054CF.3040009@oracle.com> Message-ID: I saw no issues with JShell tool and test portions of the webrev.? I did not review the nashorn changes. Testing it: editing multi-line snippets is vastly easier and more intuitive. There is one issue, with the old mechanism, as horridly clunky as it was, you could add new lines of code (a frequently needed functionality). Since is accept, I could find no way to add lines with this JLine 3 version.? Thoughts? I looked into readline commands as an approach to addressing this, found nothing.? However, most readline commands worked. Ctrl-u however did not behave as documented in readline (instead deleting to the beginning of the line).? I notice that the there is zero in-command documentation of command-line editing -- not even a mention.? Independent from the review of this port, it seems we should have in-command documentation of command editing -- even more so now that multiline editing is useful. The JShell User Manual will also need a little edit in the History Navigation section. -Robert On 11/29/18 1:06 PM, Jan Lahoda wrote: > Hi, > > I'd like to update the internal JLine used by JShell and jjs to JLine > 3.9.0. Two notable advantages of this version is multi-line snippet > editing and better UI on Windows (escape sequence support on Windows). > As a consequence, this patch drops EditingHistory, as it does not seem > to be needed anymore. > > JBS: > https://bugs.openjdk.java.net/browse/JDK-8214491 > > The full patch is here: > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ > > > To make the changes more clear, I've split it into two: > -replacement of existing JLine with the new on in jdk.internal.le, no > changes to JLine code: > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ > > -tweaks to JLine (repackaging, eliminating references to j.u.l.Logger, > adding hooks to wrap input streams with our stop-detecting input > stream, adding unicode escapes to unicode characters, support for > Windows without JNA), adjustments to JShell and jjs (unfortunately, > 3.9.0 is not compatible with the JLine 2 branch, so the changes are > substantial): > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ > > Any feedback is welcome! > > Thanks, > ??? Jan From jan.lahoda at oracle.com Wed Dec 5 17:18:56 2018 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Wed, 5 Dec 2018 18:18:56 +0100 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: References: <5C0054CF.3040009@oracle.com> Message-ID: <5C080880.2080407@oracle.com> Hi Robert, On 4.12.2018 23:59, Robert Field wrote: > I saw no issues with JShell tool and test portions of the webrev. I did > not review the nashorn changes. Thanks for looking at this! > > Testing it: editing multi-line snippets is vastly easier and more > intuitive. > There is one issue, with the old mechanism, as horridly clunky as it > was, you could add new lines of code (a frequently needed functionality). > Since is accept, I could find no way to add lines with this > JLine 3 version. Thoughts? One possibility that comes to mind: pressing Enter inside the snippet would add a new line, Enter at the very end of a (complete) snippet would confirm that snippet. Could be fairly convenient/intuitive. What do you think? > > I looked into readline commands as an approach to addressing this, found > nothing. However, most readline commands worked. Ctrl-u however did not > behave as documented in readline (instead deleting to the beginning of > the line). I notice that the there is zero in-command documentation of > command-line editing -- not even a mention. Independent from the review > of this port, it seems we should have in-command documentation of > command editing -- even more so now that multiline editing is useful. This is about enhancing /help, right? I'll see what I can do. > > The JShell User Manual will also need a little edit in the History > Navigation section. Where is that? Thanks, Jan > > -Robert > > > On 11/29/18 1:06 PM, Jan Lahoda wrote: >> Hi, >> >> I'd like to update the internal JLine used by JShell and jjs to JLine >> 3.9.0. Two notable advantages of this version is multi-line snippet >> editing and better UI on Windows (escape sequence support on Windows). >> As a consequence, this patch drops EditingHistory, as it does not seem >> to be needed anymore. >> >> JBS: >> https://bugs.openjdk.java.net/browse/JDK-8214491 >> >> The full patch is here: >> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >> >> >> To make the changes more clear, I've split it into two: >> -replacement of existing JLine with the new on in jdk.internal.le, no >> changes to JLine code: >> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >> >> -tweaks to JLine (repackaging, eliminating references to j.u.l.Logger, >> adding hooks to wrap input streams with our stop-detecting input >> stream, adding unicode escapes to unicode characters, support for >> Windows without JNA), adjustments to JShell and jjs (unfortunately, >> 3.9.0 is not compatible with the JLine 2 branch, so the changes are >> substantial): >> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >> >> Any feedback is welcome! >> >> Thanks, >> Jan From robert.field at oracle.com Wed Dec 5 21:49:07 2018 From: robert.field at oracle.com (Robert Field) Date: Wed, 05 Dec 2018 13:49:07 -0800 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <5C080880.2080407@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> Message-ID: <16780589038.2794.4011f3a8741ca2aabce58b8b81f42d24@oracle.com> On December 5, 2018 9:19:00 AM Jan Lahoda wrote: > Hi Robert, > > On 4.12.2018 23:59, Robert Field wrote: >> I saw no issues with JShell tool and test portions of the webrev. I did >> not review the nashorn changes. > > Thanks for looking at this! > >> >> Testing it: editing multi-line snippets is vastly easier and more >> intuitive. >> There is one issue, with the old mechanism, as horridly clunky as it >> was, you could add new lines of code (a frequently needed functionality). >> Since is accept, I could find no way to add lines with this >> JLine 3 version. Thoughts? > > One possibility that comes to mind: pressing Enter inside the snippet > would add a new line, Enter at the very end of a (complete) snippet > would confirm that snippet. Could be fairly convenient/intuitive. What > do you think? Robert: that would certainly make adding new lines easy, but if you were changing something in the middle, you'd have to navigate to the end of the snippet then press enter. I think we need different keys or key combos for the two actions. And in that return is the established key for accept, we are probably stick with that. Maybe we put this out explicitly to the list for ideas > > >> >> I looked into readline commands as an approach to addressing this, found >> nothing. However, most readline commands worked. Ctrl-u however did not >> behave as documented in readline (instead deleting to the beginning of >> the line). I notice that the there is zero in-command documentation of >> command-line editing -- not even a mention. Independent from the review >> of this port, it seems we should have in-command documentation of >> command editing -- even more so now that multiline editing is useful. > > This is about enhancing /help, right? I'll see what I can do. Right. And that could easily be a separate bug. /help keys Or something > > >> >> The JShell User Manual will also need a little edit in the History >> Navigation section. > > Where is that? Tech pubs does that. Once we figure out the above, I'll file a bug. > > Thanks, > Jan Robert > > >> >> -Robert >> >> >> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>> Hi, >>> >>> I'd like to update the internal JLine used by JShell and jjs to JLine >>> 3.9.0. Two notable advantages of this version is multi-line snippet >>> editing and better UI on Windows (escape sequence support on Windows). >>> As a consequence, this patch drops EditingHistory, as it does not seem >>> to be needed anymore. >>> >>> JBS: >>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>> >>> The full patch is here: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>> >>> >>> To make the changes more clear, I've split it into two: >>> -replacement of existing JLine with the new on in jdk.internal.le, no >>> changes to JLine code: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>> >>> -tweaks to JLine (repackaging, eliminating references to j.u.l.Logger, >>> adding hooks to wrap input streams with our stop-detecting input >>> stream, adding unicode escapes to unicode characters, support for >>> Windows without JNA), adjustments to JShell and jjs (unfortunately, >>> 3.9.0 is not compatible with the JLine 2 branch, so the changes are >>> substantial): >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>> >>> Any feedback is welcome! >>> >>> Thanks, >>> Jan From sundararajan.athijegannathan at oracle.com Thu Dec 6 02:55:27 2018 From: sundararajan.athijegannathan at oracle.com (Sundararajan Athijegannathan) Date: Thu, 06 Dec 2018 08:25:27 +0530 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <5C080880.2080407@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> Message-ID: <5C088F9F.5020902@oracle.com> CC'ing nashorn-dev. -Sundar On 05/12/18, 10:48 PM, Jan Lahoda wrote: > Hi Robert, > > On 4.12.2018 23:59, Robert Field wrote: >> I saw no issues with JShell tool and test portions of the webrev. I did >> not review the nashorn changes. > > Thanks for looking at this! > >> >> Testing it: editing multi-line snippets is vastly easier and more >> intuitive. >> There is one issue, with the old mechanism, as horridly clunky as it >> was, you could add new lines of code (a frequently needed >> functionality). >> Since is accept, I could find no way to add lines with this >> JLine 3 version. Thoughts? > > One possibility that comes to mind: pressing Enter inside the snippet > would add a new line, Enter at the very end of a (complete) snippet > would confirm that snippet. Could be fairly convenient/intuitive. What > do you think? > >> >> I looked into readline commands as an approach to addressing this, found >> nothing. However, most readline commands worked. Ctrl-u however did not >> behave as documented in readline (instead deleting to the beginning of >> the line). I notice that the there is zero in-command documentation of >> command-line editing -- not even a mention. Independent from the review >> of this port, it seems we should have in-command documentation of >> command editing -- even more so now that multiline editing is useful. > > This is about enhancing /help, right? I'll see what I can do. > >> >> The JShell User Manual will also need a little edit in the History >> Navigation section. > > Where is that? > > Thanks, > Jan > >> >> -Robert >> >> >> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>> Hi, >>> >>> I'd like to update the internal JLine used by JShell and jjs to JLine >>> 3.9.0. Two notable advantages of this version is multi-line snippet >>> editing and better UI on Windows (escape sequence support on Windows). >>> As a consequence, this patch drops EditingHistory, as it does not seem >>> to be needed anymore. >>> >>> JBS: >>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>> >>> The full patch is here: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>> >>> >>> To make the changes more clear, I've split it into two: >>> -replacement of existing JLine with the new on in jdk.internal.le, no >>> changes to JLine code: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>> >>> -tweaks to JLine (repackaging, eliminating references to j.u.l.Logger, >>> adding hooks to wrap input streams with our stop-detecting input >>> stream, adding unicode escapes to unicode characters, support for >>> Windows without JNA), adjustments to JShell and jjs (unfortunately, >>> 3.9.0 is not compatible with the JLine 2 branch, so the changes are >>> substantial): >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>> >>> Any feedback is welcome! >>> >>> Thanks, >>> Jan From robert.field at oracle.com Thu Dec 6 04:46:34 2018 From: robert.field at oracle.com (Robert Field) Date: Wed, 5 Dec 2018 20:46:34 -0800 Subject: JShell: Request for ideas: Editing multiline snippets, adding lines Message-ID: <60F4F891-8481-480E-9DD8-F4A70BF91ABF@oracle.com> A fix about to go back to JDK 12 (see JLine 3 review discussion) provides a significant improvement when editing multiline snippets ? they are treated as an integral unit ? with WYSIWYG-ish interaction. There is however one limitation: Since has its legacy action of accepting the input, there is no way with line editing to add a line within a multiline snippet. It would seem that a different input is needed to add a line (unless I?m missing something). Suggestions for that keystroke are herein solicited. Thanks, Robert From michel.trudeau at oracle.com Thu Dec 6 05:08:59 2018 From: michel.trudeau at oracle.com (Michel Trudeau) Date: Wed, 5 Dec 2018 21:08:59 -0800 Subject: JShell: Request for ideas: Editing multiline snippets, adding lines In-Reply-To: <60F4F891-8481-480E-9DD8-F4A70BF91ABF@oracle.com> References: <60F4F891-8481-480E-9DD8-F4A70BF91ABF@oracle.com> Message-ID: <828669D6-589E-42FB-AA95-2A5EC548CDF9@oracle.com> What about Ctrl-Enter ? On Dec 5, 2018, at 8:46 PM, Robert Field wrote: A fix about to go back to JDK 12 (see JLine 3 review discussion) provides a significant improvement when editing multiline snippets ? they are treated as an integral unit ? with WYSIWYG-ish interaction. There is however one limitation: Since has its legacy action of accepting the input, there is no way with line editing to add a line within a multiline snippet. It would seem that a different input is needed to add a line (unless I?m missing something). Suggestions for that keystroke are herein solicited. Thanks, Robert From jan.lahoda at oracle.com Thu Dec 6 15:20:41 2018 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Thu, 6 Dec 2018 16:20:41 +0100 Subject: JShell: Request for ideas: Editing multiline snippets, adding lines In-Reply-To: <828669D6-589E-42FB-AA95-2A5EC548CDF9@oracle.com> References: <60F4F891-8481-480E-9DD8-F4A70BF91ABF@oracle.com> <828669D6-589E-42FB-AA95-2A5EC548CDF9@oracle.com> Message-ID: <5C093E49.7010705@oracle.com> On 6.12.2018 06:08, Michel Trudeau wrote: > What about Ctrl-Enter ? Actually, Alt-Enter turnes out to work on Linux (KDE Konsole) as a shortcut to add a new line. The main issue here is that we can only use shortcuts for which the terminal will produce an escape sequence, and IIRC on Mac this was very troublesome (the shortcuts that produced escape sequences and that we could use were severely limited). So the Alt-Enter may not work on Mac (I believe we wanted to have the "add import" bound to Alt-Enter and it was not possible on Mac). If someone with Mac could try with this patch: --- diff -r 183e274baccd src/jdk.internal.le/share/classes/jdk/internal/org/jline/keymap/BindingReader.java --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/keymap/BindingReader.java Thu Dec 06 15:05:31 2018 +0100 +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/keymap/BindingReader.java Thu Dec 06 16:00:04 2018 +0100 @@ -11,7 +11,10 @@ import java.io.IOError; import java.io.IOException; import java.util.ArrayDeque; +import java.util.Arrays; import java.util.Deque; +import java.util.stream.Collectors; +import java.util.stream.StreamSupport; import jdk.internal.org.jline.reader.EndOfFileException; import jdk.internal.org.jline.utils.ClosedException; @@ -112,6 +115,12 @@ return null; } opBuffer.appendCodePoint(c); + System.err.print("opBuffer='"); + for (char cc : opBuffer.toString().toCharArray()) { + System.err.print(Integer.toHexString(cc)); + System.err.print(" "); + } + System.err.println("'"); hasRead = true; } return null; --- When a key or a combination of keys is pressed, it should print output like: opBuffer='1b d ' (this is for Alt-Enter for me). If there's some useful combination on Mac that prints something distinguishable, we can use that as a shortcut. Thanks, Jan > > On Dec 5, 2018, at 8:46 PM, Robert Field wrote: > > A fix about to go back to JDK 12 (see JLine 3 review discussion) provides a significant improvement when editing multiline snippets ? they are treated as an integral unit ? with WYSIWYG-ish interaction. > > There is however one limitation: Since has its legacy action of accepting the input, there is no way with line editing to add a line within a multiline snippet. > > It would seem that a different input is needed to add a line (unless I?m missing something). Suggestions for that keystroke are herein solicited. > > Thanks, > Robert > > From jan.lahoda at oracle.com Sat Dec 8 15:21:54 2018 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Sat, 8 Dec 2018 16:21:54 +0100 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <5C080880.2080407@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> Message-ID: <5C0BE192.8010404@oracle.com> Hi, I've updated the patch to reflect the comments so far, the current version is here: http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01/ Delta since the previous version is here for convenience: http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01/ In this version, while editing a snippet, a new line can be added using Alt-Enter (on platforms that support that), or Ctrl-Enter (on Windows). And alternative patch is here: http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01a/ Delta: http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01a/ In the alternative version, Enter will only "confirm" multi-line snippet when the cursor is at the end of the snippet, otherwise it will add a new line (so that a special shortcut is not needed; but a snippet cannot be "confirmed" by pressing Enter in the middle of a multi-line snippet.) The only difference between the .01 and .01a patches is the way they allow to add new lines into the multi-line snippets. Other changes are the same. Any feedback on this is welcome. Thanks! Jan On 5.12.2018 18:18, Jan Lahoda wrote: > Hi Robert, > > On 4.12.2018 23:59, Robert Field wrote: >> I saw no issues with JShell tool and test portions of the webrev. I did >> not review the nashorn changes. > > Thanks for looking at this! > >> >> Testing it: editing multi-line snippets is vastly easier and more >> intuitive. >> There is one issue, with the old mechanism, as horridly clunky as it >> was, you could add new lines of code (a frequently needed functionality). >> Since is accept, I could find no way to add lines with this >> JLine 3 version. Thoughts? > > One possibility that comes to mind: pressing Enter inside the snippet > would add a new line, Enter at the very end of a (complete) snippet > would confirm that snippet. Could be fairly convenient/intuitive. What > do you think? > >> >> I looked into readline commands as an approach to addressing this, found >> nothing. However, most readline commands worked. Ctrl-u however did not >> behave as documented in readline (instead deleting to the beginning of >> the line). I notice that the there is zero in-command documentation of >> command-line editing -- not even a mention. Independent from the review >> of this port, it seems we should have in-command documentation of >> command editing -- even more so now that multiline editing is useful. > > This is about enhancing /help, right? I'll see what I can do. > >> >> The JShell User Manual will also need a little edit in the History >> Navigation section. > > Where is that? > > Thanks, > Jan > >> >> -Robert >> >> >> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>> Hi, >>> >>> I'd like to update the internal JLine used by JShell and jjs to JLine >>> 3.9.0. Two notable advantages of this version is multi-line snippet >>> editing and better UI on Windows (escape sequence support on Windows). >>> As a consequence, this patch drops EditingHistory, as it does not seem >>> to be needed anymore. >>> >>> JBS: >>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>> >>> The full patch is here: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>> >>> >>> To make the changes more clear, I've split it into two: >>> -replacement of existing JLine with the new on in jdk.internal.le, no >>> changes to JLine code: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>> >>> -tweaks to JLine (repackaging, eliminating references to j.u.l.Logger, >>> adding hooks to wrap input streams with our stop-detecting input >>> stream, adding unicode escapes to unicode characters, support for >>> Windows without JNA), adjustments to JShell and jjs (unfortunately, >>> 3.9.0 is not compatible with the JLine 2 branch, so the changes are >>> substantial): >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>> >>> Any feedback is welcome! >>> >>> Thanks, >>> Jan From robert.field at oracle.com Sat Dec 8 19:39:04 2018 From: robert.field at oracle.com (Robert Field) Date: Sat, 8 Dec 2018 11:39:04 -0800 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <5C0BE192.8010404@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> <5C0BE192.8010404@oracle.com> Message-ID: <1fd7c4d3-b446-f695-025e-3ef3c0980744@oracle.com> Thanks for updating. Good to have /help for line editing keys, however: ? (1) The supported keys should be listed without requiring that the user knows or looks-up readline. More so, since only some readline keys are supposed. ? (2) "/edit" is a command, so with this change, typing "/help edit" would give both the /edit and editing help -- which would be confusing.? I suggest "/help keys", there are no "k" help items. ? (3) In jshell tool online docs the tool is spelled "jshell tool" I'd be happy to write up suggested text. As to the alternative patch: I understand the motivation, it would be nice to just use the natural "Enter" as new line. Unfortunately it's functionality is then overloaded.? I believe the alternative will be confusing and awkward: ? (1) It breaks backward compatibility in user experience, Enter has always been accept/evaluate ? (2) It would be very awkward and non-intuitive (particularly in a long multiline snippet) to have to navigate to the end of the snippet to accept. ?????? Note: must be the end both vertically and horizontally. ? (3) It is inconsistent: Mid snippet Enter on one line does accept.? However, on a continuation line (say after "int x =") it adds a new line instead. ? (4) It doesn't solve the problem for the most common location for adding a new line, the end of snippet -- thus introducing more inconsistency. Thanks, Robert On 12/8/18 7:21 AM, Jan Lahoda wrote: > Hi, > > I've updated the patch to reflect the comments so far, the current > version is here: > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01/ > Delta since the previous version is here for convenience: > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01/ > > In this version, while editing a snippet, a new line can be added > using Alt-Enter (on platforms that support that), or Ctrl-Enter (on > Windows). > > > And alternative patch is here: > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01a/ > Delta: > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01a/ > > In the alternative version, Enter will only "confirm" multi-line > snippet when the cursor is at the end of the snippet, otherwise it > will add a new line (so that a special shortcut is not needed; but a > snippet cannot be "confirmed" by pressing Enter in the middle of a > multi-line snippet.) > > The only difference between the .01 and .01a patches is the way they > allow to add new lines into the multi-line snippets. Other changes are > the same. > > Any feedback on this is welcome. > > Thanks! > > Jan > > On 5.12.2018 18:18, Jan Lahoda wrote: >> Hi Robert, >> >> On 4.12.2018 23:59, Robert Field wrote: >>> I saw no issues with JShell tool and test portions of the webrev.? I >>> did >>> not review the nashorn changes. >> >> Thanks for looking at this! >> >>> >>> Testing it: editing multi-line snippets is vastly easier and more >>> intuitive. >>> There is one issue, with the old mechanism, as horridly clunky as it >>> was, you could add new lines of code (a frequently needed >>> functionality). >>> Since is accept, I could find no way to add lines with this >>> JLine 3 version.? Thoughts? >> >> One possibility that comes to mind: pressing Enter inside the snippet >> would add a new line, Enter at the very end of a (complete) snippet >> would confirm that snippet. Could be fairly convenient/intuitive. What >> do you think? >> >>> >>> I looked into readline commands as an approach to addressing this, >>> found >>> nothing.? However, most readline commands worked. Ctrl-u however did >>> not >>> behave as documented in readline (instead deleting to the beginning of >>> the line).? I notice that the there is zero in-command documentation of >>> command-line editing -- not even a mention.? Independent from the >>> review >>> of this port, it seems we should have in-command documentation of >>> command editing -- even more so now that multiline editing is useful. >> >> This is about enhancing /help, right? I'll see what I can do. >> >>> >>> The JShell User Manual will also need a little edit in the History >>> Navigation section. >> >> Where is that? >> >> Thanks, >> ???? Jan >> >>> >>> -Robert >>> >>> >>> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>>> Hi, >>>> >>>> I'd like to update the internal JLine used by JShell and jjs to JLine >>>> 3.9.0. Two notable advantages of this version is multi-line snippet >>>> editing and better UI on Windows (escape sequence support on Windows). >>>> As a consequence, this patch drops EditingHistory, as it does not seem >>>> to be needed anymore. >>>> >>>> JBS: >>>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>>> >>>> The full patch is here: >>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>>> >>>> >>>> To make the changes more clear, I've split it into two: >>>> -replacement of existing JLine with the new on in jdk.internal.le, no >>>> changes to JLine code: >>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>>> >>>> -tweaks to JLine (repackaging, eliminating references to j.u.l.Logger, >>>> adding hooks to wrap input streams with our stop-detecting input >>>> stream, adding unicode escapes to unicode characters, support for >>>> Windows without JNA), adjustments to JShell and jjs (unfortunately, >>>> 3.9.0 is not compatible with the JLine 2 branch, so the changes are >>>> substantial): >>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>>> >>>> Any feedback is welcome! >>>> >>>> Thanks, >>>> ??? Jan From jan.lahoda at oracle.com Sat Dec 8 19:47:06 2018 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Sat, 8 Dec 2018 20:47:06 +0100 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <1fd7c4d3-b446-f695-025e-3ef3c0980744@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> <5C0BE192.8010404@oracle.com> <1fd7c4d3-b446-f695-025e-3ef3c0980744@oracle.com> Message-ID: <5C0C1FBA.2050602@oracle.com> On 8.12.2018 20:39, Robert Field wrote: > Thanks for updating. > > Good to have /help for line editing keys, however: > (1) The supported keys should be listed without requiring that the > user knows or looks-up readline. More so, since only some readline keys > are supposed. > (2) "/edit" is a command, so with this change, typing "/help edit" > would give both the /edit and editing help -- which would be confusing. > I suggest "/help keys", there are no "k" help items. Will do. > (3) In jshell tool online docs the tool is spelled "jshell tool" > I'd be happy to write up suggested text. Thanks, that would be very welcome! > > As to the alternative patch: I understand the motivation, it would be > nice to just use the natural "Enter" as new line. Unfortunately it's > functionality is then overloaded. I believe the alternative will be > confusing and awkward: > (1) It breaks backward compatibility in user experience, Enter has > always been accept/evaluate > (2) It would be very awkward and non-intuitive (particularly in a > long multiline snippet) to have to navigate to the end of the snippet to > accept. > Note: must be the end both vertically and horizontally. > (3) It is inconsistent: Mid snippet Enter on one line does accept. > However, on a continuation line (say after "int x =") it adds a new line > instead. > (4) It doesn't solve the problem for the most common location for > adding a new line, the end of snippet -- thus introducing more > inconsistency. Ok. This was meant more as a backup in case there's no reasonable shortcut we could use to add new lines. Thanks for the comments! Jan > > Thanks, > Robert > > > On 12/8/18 7:21 AM, Jan Lahoda wrote: >> Hi, >> >> I've updated the patch to reflect the comments so far, the current >> version is here: >> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01/ >> Delta since the previous version is here for convenience: >> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01/ >> >> In this version, while editing a snippet, a new line can be added >> using Alt-Enter (on platforms that support that), or Ctrl-Enter (on >> Windows). >> >> >> And alternative patch is here: >> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01a/ >> Delta: >> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01a/ >> >> In the alternative version, Enter will only "confirm" multi-line >> snippet when the cursor is at the end of the snippet, otherwise it >> will add a new line (so that a special shortcut is not needed; but a >> snippet cannot be "confirmed" by pressing Enter in the middle of a >> multi-line snippet.) >> >> The only difference between the .01 and .01a patches is the way they >> allow to add new lines into the multi-line snippets. Other changes are >> the same. >> >> Any feedback on this is welcome. >> >> Thanks! >> >> Jan >> >> On 5.12.2018 18:18, Jan Lahoda wrote: >>> Hi Robert, >>> >>> On 4.12.2018 23:59, Robert Field wrote: >>>> I saw no issues with JShell tool and test portions of the webrev. I >>>> did >>>> not review the nashorn changes. >>> >>> Thanks for looking at this! >>> >>>> >>>> Testing it: editing multi-line snippets is vastly easier and more >>>> intuitive. >>>> There is one issue, with the old mechanism, as horridly clunky as it >>>> was, you could add new lines of code (a frequently needed >>>> functionality). >>>> Since is accept, I could find no way to add lines with this >>>> JLine 3 version. Thoughts? >>> >>> One possibility that comes to mind: pressing Enter inside the snippet >>> would add a new line, Enter at the very end of a (complete) snippet >>> would confirm that snippet. Could be fairly convenient/intuitive. What >>> do you think? >>> >>>> >>>> I looked into readline commands as an approach to addressing this, >>>> found >>>> nothing. However, most readline commands worked. Ctrl-u however did >>>> not >>>> behave as documented in readline (instead deleting to the beginning of >>>> the line). I notice that the there is zero in-command documentation of >>>> command-line editing -- not even a mention. Independent from the >>>> review >>>> of this port, it seems we should have in-command documentation of >>>> command editing -- even more so now that multiline editing is useful. >>> >>> This is about enhancing /help, right? I'll see what I can do. >>> >>>> >>>> The JShell User Manual will also need a little edit in the History >>>> Navigation section. >>> >>> Where is that? >>> >>> Thanks, >>> Jan >>> >>>> >>>> -Robert >>>> >>>> >>>> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>>>> Hi, >>>>> >>>>> I'd like to update the internal JLine used by JShell and jjs to JLine >>>>> 3.9.0. Two notable advantages of this version is multi-line snippet >>>>> editing and better UI on Windows (escape sequence support on Windows). >>>>> As a consequence, this patch drops EditingHistory, as it does not seem >>>>> to be needed anymore. >>>>> >>>>> JBS: >>>>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>>>> >>>>> The full patch is here: >>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>>>> >>>>> >>>>> To make the changes more clear, I've split it into two: >>>>> -replacement of existing JLine with the new on in jdk.internal.le, no >>>>> changes to JLine code: >>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>>>> >>>>> -tweaks to JLine (repackaging, eliminating references to j.u.l.Logger, >>>>> adding hooks to wrap input streams with our stop-detecting input >>>>> stream, adding unicode escapes to unicode characters, support for >>>>> Windows without JNA), adjustments to JShell and jjs (unfortunately, >>>>> 3.9.0 is not compatible with the JLine 2 branch, so the changes are >>>>> substantial): >>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>>>> >>>>> Any feedback is welcome! >>>>> >>>>> Thanks, >>>>> Jan From robert.field at oracle.com Sat Dec 8 19:49:00 2018 From: robert.field at oracle.com (Robert Field) Date: Sat, 8 Dec 2018 11:49:00 -0800 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <5C0C1FBA.2050602@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> <5C0BE192.8010404@oracle.com> <1fd7c4d3-b446-f695-025e-3ef3c0980744@oracle.com> <5C0C1FBA.2050602@oracle.com> Message-ID: <4c78f958-42f9-f83a-b2ae-3f9254038286@oracle.com> On 12/8/18 11:47 AM, Jan Lahoda wrote: > On 8.12.2018 20:39, Robert Field wrote: >> Thanks for updating. >> >> Good to have /help for line editing keys, however: >> ?? (1) The supported keys should be listed without requiring that the >> user knows or looks-up readline. More so, since only some readline keys >> are supposed. >> ?? (2) "/edit" is a command, so with this change, typing "/help edit" >> would give both the /edit and editing help -- which would be confusing. >> I suggest "/help keys", there are no "k" help items. > > Will do. > >> ?? (3) In jshell tool online docs the tool is spelled "jshell tool" >> I'd be happy to write up suggested text. > > Thanks, that would be very welcome! OK, I'll put something together now. -Robert > >> >> As to the alternative patch: I understand the motivation, it would be >> nice to just use the natural "Enter" as new line. Unfortunately it's >> functionality is then overloaded.? I believe the alternative will be >> confusing and awkward: >> ?? (1) It breaks backward compatibility in user experience, Enter has >> always been accept/evaluate >> ?? (2) It would be very awkward and non-intuitive (particularly in a >> long multiline snippet) to have to navigate to the end of the snippet to >> accept. >> ??????? Note: must be the end both vertically and horizontally. >> ?? (3) It is inconsistent: Mid snippet Enter on one line does accept. >> However, on a continuation line (say after "int x =") it adds a new line >> instead. >> ?? (4) It doesn't solve the problem for the most common location for >> adding a new line, the end of snippet -- thus introducing more >> inconsistency. > > Ok. This was meant more as a backup in case there's no reasonable > shortcut we could use to add new lines. > > Thanks for the comments! > > Jan > >> >> Thanks, >> Robert >> >> >> On 12/8/18 7:21 AM, Jan Lahoda wrote: >>> Hi, >>> >>> I've updated the patch to reflect the comments so far, the current >>> version is here: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01/ >>> Delta since the previous version is here for convenience: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01/ >>> >>> In this version, while editing a snippet, a new line can be added >>> using Alt-Enter (on platforms that support that), or Ctrl-Enter (on >>> Windows). >>> >>> >>> And alternative patch is here: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01a/ >>> Delta: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01a/ >>> >>> In the alternative version, Enter will only "confirm" multi-line >>> snippet when the cursor is at the end of the snippet, otherwise it >>> will add a new line (so that a special shortcut is not needed; but a >>> snippet cannot be "confirmed" by pressing Enter in the middle of a >>> multi-line snippet.) >>> >>> The only difference between the .01 and .01a patches is the way they >>> allow to add new lines into the multi-line snippets. Other changes are >>> the same. >>> >>> Any feedback on this is welcome. >>> >>> Thanks! >>> >>> Jan >>> >>> On 5.12.2018 18:18, Jan Lahoda wrote: >>>> Hi Robert, >>>> >>>> On 4.12.2018 23:59, Robert Field wrote: >>>>> I saw no issues with JShell tool and test portions of the webrev.? I >>>>> did >>>>> not review the nashorn changes. >>>> >>>> Thanks for looking at this! >>>> >>>>> >>>>> Testing it: editing multi-line snippets is vastly easier and more >>>>> intuitive. >>>>> There is one issue, with the old mechanism, as horridly clunky as it >>>>> was, you could add new lines of code (a frequently needed >>>>> functionality). >>>>> Since is accept, I could find no way to add lines with this >>>>> JLine 3 version.? Thoughts? >>>> >>>> One possibility that comes to mind: pressing Enter inside the snippet >>>> would add a new line, Enter at the very end of a (complete) snippet >>>> would confirm that snippet. Could be fairly convenient/intuitive. What >>>> do you think? >>>> >>>>> >>>>> I looked into readline commands as an approach to addressing this, >>>>> found >>>>> nothing.? However, most readline commands worked. Ctrl-u however did >>>>> not >>>>> behave as documented in readline (instead deleting to the >>>>> beginning of >>>>> the line).? I notice that the there is zero in-command >>>>> documentation of >>>>> command-line editing -- not even a mention.? Independent from the >>>>> review >>>>> of this port, it seems we should have in-command documentation of >>>>> command editing -- even more so now that multiline editing is useful. >>>> >>>> This is about enhancing /help, right? I'll see what I can do. >>>> >>>>> >>>>> The JShell User Manual will also need a little edit in the History >>>>> Navigation section. >>>> >>>> Where is that? >>>> >>>> Thanks, >>>> ???? Jan >>>> >>>>> >>>>> -Robert >>>>> >>>>> >>>>> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>>>>> Hi, >>>>>> >>>>>> I'd like to update the internal JLine used by JShell and jjs to >>>>>> JLine >>>>>> 3.9.0. Two notable advantages of this version is multi-line snippet >>>>>> editing and better UI on Windows (escape sequence support on >>>>>> Windows). >>>>>> As a consequence, this patch drops EditingHistory, as it does not >>>>>> seem >>>>>> to be needed anymore. >>>>>> >>>>>> JBS: >>>>>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>>>>> >>>>>> The full patch is here: >>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>>>>> >>>>>> >>>>>> To make the changes more clear, I've split it into two: >>>>>> -replacement of existing JLine with the new on in >>>>>> jdk.internal.le, no >>>>>> changes to JLine code: >>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>>>>> >>>>>> -tweaks to JLine (repackaging, eliminating references to >>>>>> j.u.l.Logger, >>>>>> adding hooks to wrap input streams with our stop-detecting input >>>>>> stream, adding unicode escapes to unicode characters, support for >>>>>> Windows without JNA), adjustments to JShell and jjs (unfortunately, >>>>>> 3.9.0 is not compatible with the JLine 2 branch, so the changes are >>>>>> substantial): >>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>>>>> >>>>>> Any feedback is welcome! >>>>>> >>>>>> Thanks, >>>>>> ??? Jan From robert.field at oracle.com Sun Dec 9 01:40:59 2018 From: robert.field at oracle.com (Robert Field) Date: Sat, 8 Dec 2018 17:40:59 -0800 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <5C0C1FBA.2050602@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> <5C0BE192.8010404@oracle.com> <1fd7c4d3-b446-f695-025e-3ef3c0980744@oracle.com> <5C0C1FBA.2050602@oracle.com> Message-ID: <6eef7f37-897c-7f02-f430-13400cdbc80a@oracle.com> OK, here is my thinking on a /help keys entry.? Note: I'm using the representation for keys used by the User's Guide -- which I assume is the official tech pubs style -- seems we should be consistent; If we are however, the other /help entries should be brought into compliance (they seem to be all over the map already).? May make sense to spin this off as a separate bug, which I'd be happy to take on. Comments welcome --- __________________________________________________________________________________________________________________________ /help keys ========== The jshell tool provides line editing support to allow you to navigate within and edit snippets and commands. The current command/snippet can be edited, or prior commands/snippets can be retrieved from history, edited, and executed. This support is similar to readline/editline with simple emacs-like bindings.? There are also jshell tool specific key sequences. --- Line and history navigation --- Return ? Enters the current snippet Left-arrow or Ctrl+B ? Moves backward one character Right-arrow or Ctrl+F ? Moves forward one character Up-arrow or Ctrl+P ? Moves up one line, backward through history Down arrow or Ctrl+N ? Moves down one line, forward through history Ctrl+A ? Moves to the beginning of the line Ctrl+E ? Moves to the end of the line Meta+B ? Moves backward one word Meta+F ? Moves forward one word Ctrl+R ? Search backward through history --- Line and history basic editing --- Meta+Return or Ctrl+Return (depending on platform) ? Insert a new line in snippet Ctrl+_ (underscore may require shift key) or Ctrl-X then Ctrl-U ? Undo edit - repeat to undo more edits Delete ? Deletes the character at or after the cursor, depending on the operating system Backspace ? Deletes the character before the cursor Ctrl+K ? Deletes the text from the cursor to the end of the line Meta+D ? Deletes the text from the cursor to the end of the word Ctrl+W ? Deletes the text from the cursor to the previous white space Ctrl+Y ? Pastes the most recently deleted text into the line Meta+Y ? After Ctrl+Y, Meta+Y cycles through previously deleted text Ctrl+X then Ctrl+K ? Delete whole snippet --- Shortcuts for jshell tool --- For details, see: /help shortcuts Tab ? Complete Java identifier or jshell command Shift+Tab then v ? Convert expression to variable declaration Shift+Tab then m ? Convert statement to method declaration Shift+Tab then i ? Add imports for this identifier --- More line and history editing --- Ctrl+L ? Clear screen and reprint snippet Ctrl+U ? Kill whole line Ctrl+T ? Transpose characters Ctrl+X then Ctrl+B ? Navigate to matching bracket, parenthesis, ... Ctrl+X then = ? Enter show current character position mode Ctrl+X then Ctrl+O ? Toggle overwrite characters vs insert characters Meta+C ? Capitalize word Meta+U ? Convert word to uppercase Meta+L ? Convert word to lowercase Meta+0 through Meta+9 then key ? Repeat the specified number of times Where, for example, "Ctrl+A" means hold down the control key and press A. Where "Meta" is "Alt" on many keyboards. Line editing support is derived from JLine 3. _______________________________________________________________________________ -Robert On 12/8/18 11:47 AM, Jan Lahoda wrote: > On 8.12.2018 20:39, Robert Field wrote: >> Thanks for updating. >> >> Good to have /help for line editing keys, however: >> ?? (1) The supported keys should be listed without requiring that the >> user knows or looks-up readline. More so, since only some readline keys >> are supposed. >> ?? (2) "/edit" is a command, so with this change, typing "/help edit" >> would give both the /edit and editing help -- which would be confusing. >> I suggest "/help keys", there are no "k" help items. > > Will do. > >> ?? (3) In jshell tool online docs the tool is spelled "jshell tool" >> I'd be happy to write up suggested text. > > Thanks, that would be very welcome! > >> >> As to the alternative patch: I understand the motivation, it would be >> nice to just use the natural "Enter" as new line. Unfortunately it's >> functionality is then overloaded.? I believe the alternative will be >> confusing and awkward: >> ?? (1) It breaks backward compatibility in user experience, Enter has >> always been accept/evaluate >> ?? (2) It would be very awkward and non-intuitive (particularly in a >> long multiline snippet) to have to navigate to the end of the snippet to >> accept. >> ??????? Note: must be the end both vertically and horizontally. >> ?? (3) It is inconsistent: Mid snippet Enter on one line does accept. >> However, on a continuation line (say after "int x =") it adds a new line >> instead. >> ?? (4) It doesn't solve the problem for the most common location for >> adding a new line, the end of snippet -- thus introducing more >> inconsistency. > > Ok. This was meant more as a backup in case there's no reasonable > shortcut we could use to add new lines. > > Thanks for the comments! > > Jan > >> >> Thanks, >> Robert >> >> >> On 12/8/18 7:21 AM, Jan Lahoda wrote: >>> Hi, >>> >>> I've updated the patch to reflect the comments so far, the current >>> version is here: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01/ >>> Delta since the previous version is here for convenience: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01/ >>> >>> In this version, while editing a snippet, a new line can be added >>> using Alt-Enter (on platforms that support that), or Ctrl-Enter (on >>> Windows). >>> >>> >>> And alternative patch is here: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01a/ >>> Delta: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01a/ >>> >>> In the alternative version, Enter will only "confirm" multi-line >>> snippet when the cursor is at the end of the snippet, otherwise it >>> will add a new line (so that a special shortcut is not needed; but a >>> snippet cannot be "confirmed" by pressing Enter in the middle of a >>> multi-line snippet.) >>> >>> The only difference between the .01 and .01a patches is the way they >>> allow to add new lines into the multi-line snippets. Other changes are >>> the same. >>> >>> Any feedback on this is welcome. >>> >>> Thanks! >>> >>> Jan >>> >>> On 5.12.2018 18:18, Jan Lahoda wrote: >>>> Hi Robert, >>>> >>>> On 4.12.2018 23:59, Robert Field wrote: >>>>> I saw no issues with JShell tool and test portions of the webrev.? I >>>>> did >>>>> not review the nashorn changes. >>>> >>>> Thanks for looking at this! >>>> >>>>> >>>>> Testing it: editing multi-line snippets is vastly easier and more >>>>> intuitive. >>>>> There is one issue, with the old mechanism, as horridly clunky as it >>>>> was, you could add new lines of code (a frequently needed >>>>> functionality). >>>>> Since is accept, I could find no way to add lines with this >>>>> JLine 3 version.? Thoughts? >>>> >>>> One possibility that comes to mind: pressing Enter inside the snippet >>>> would add a new line, Enter at the very end of a (complete) snippet >>>> would confirm that snippet. Could be fairly convenient/intuitive. What >>>> do you think? >>>> >>>>> >>>>> I looked into readline commands as an approach to addressing this, >>>>> found >>>>> nothing.? However, most readline commands worked. Ctrl-u however did >>>>> not >>>>> behave as documented in readline (instead deleting to the >>>>> beginning of >>>>> the line).? I notice that the there is zero in-command >>>>> documentation of >>>>> command-line editing -- not even a mention.? Independent from the >>>>> review >>>>> of this port, it seems we should have in-command documentation of >>>>> command editing -- even more so now that multiline editing is useful. >>>> >>>> This is about enhancing /help, right? I'll see what I can do. >>>> >>>>> >>>>> The JShell User Manual will also need a little edit in the History >>>>> Navigation section. >>>> >>>> Where is that? >>>> >>>> Thanks, >>>> ???? Jan >>>> >>>>> >>>>> -Robert >>>>> >>>>> >>>>> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>>>>> Hi, >>>>>> >>>>>> I'd like to update the internal JLine used by JShell and jjs to >>>>>> JLine >>>>>> 3.9.0. Two notable advantages of this version is multi-line snippet >>>>>> editing and better UI on Windows (escape sequence support on >>>>>> Windows). >>>>>> As a consequence, this patch drops EditingHistory, as it does not >>>>>> seem >>>>>> to be needed anymore. >>>>>> >>>>>> JBS: >>>>>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>>>>> >>>>>> The full patch is here: >>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>>>>> >>>>>> >>>>>> To make the changes more clear, I've split it into two: >>>>>> -replacement of existing JLine with the new on in >>>>>> jdk.internal.le, no >>>>>> changes to JLine code: >>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>>>>> >>>>>> -tweaks to JLine (repackaging, eliminating references to >>>>>> j.u.l.Logger, >>>>>> adding hooks to wrap input streams with our stop-detecting input >>>>>> stream, adding unicode escapes to unicode characters, support for >>>>>> Windows without JNA), adjustments to JShell and jjs (unfortunately, >>>>>> 3.9.0 is not compatible with the JLine 2 branch, so the changes are >>>>>> substantial): >>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>>>>> >>>>>> Any feedback is welcome! >>>>>> >>>>>> Thanks, >>>>>> ??? Jan From jan.lahoda at oracle.com Sun Dec 9 14:36:22 2018 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Sun, 9 Dec 2018 15:36:22 +0100 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <6eef7f37-897c-7f02-f430-13400cdbc80a@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> <5C0BE192.8010404@oracle.com> <1fd7c4d3-b446-f695-025e-3ef3c0980744@oracle.com> <5C0C1FBA.2050602@oracle.com> <6eef7f37-897c-7f02-f430-13400cdbc80a@oracle.com> Message-ID: <5C0D2866.6020105@oracle.com> Hi Robert, On 9.12.2018 02:40, Robert Field wrote: > OK, here is my thinking on a /help keys entry. Note: I'm using the I think this looks great! > representation for keys used by the User's Guide -- which I assume is > the official tech pubs style -- seems we should be consistent; If we are > however, the other /help entries should be brought into compliance (they > seem to be all over the map already). May make sense to spin this off > as a separate bug, which I'd be happy to take on. I'm happy with a separate bug, if you prefer/are OK with that. Or I can incorporate the text into upgrade patch, whichever you prefer. I've updated my current patch with only a rename "editing" -> "keys" and the fix to the jshell tool name: http://cr.openjdk.java.net/~jlahoda/8214491/webrev.02/ Delta from last: http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.01.02/ Jan > > Comments welcome --- > > __________________________________________________________________________________________________________________________ > > > /help keys > ========== > > The jshell tool provides line editing support to allow you to navigate > within and edit snippets and commands. The current command/snippet can > be edited, or prior commands/snippets can be retrieved from history, > edited, and executed. This support is similar to readline/editline with > simple emacs-like bindings. There are also jshell tool specific key > sequences. > > --- Line and history navigation --- > > Return > Enters the current snippet > Left-arrow or Ctrl+B > Moves backward one character > Right-arrow or Ctrl+F > Moves forward one character > Up-arrow or Ctrl+P > Moves up one line, backward through history > Down arrow or Ctrl+N > Moves down one line, forward through history > Ctrl+A > Moves to the beginning of the line > Ctrl+E > Moves to the end of the line > Meta+B > Moves backward one word > Meta+F > Moves forward one word > Ctrl+R > Search backward through history > > > --- Line and history basic editing --- > > Meta+Return or Ctrl+Return (depending on platform) > Insert a new line in snippet > Ctrl+_ (underscore may require shift key) or Ctrl-X then Ctrl-U > Undo edit - repeat to undo more edits > Delete > Deletes the character at or after the cursor, depending on the > operating system > Backspace > Deletes the character before the cursor > Ctrl+K > Deletes the text from the cursor to the end of the line > Meta+D > Deletes the text from the cursor to the end of the word > Ctrl+W > Deletes the text from the cursor to the previous white space > Ctrl+Y > Pastes the most recently deleted text into the line > Meta+Y > After Ctrl+Y, Meta+Y cycles through previously deleted text > Ctrl+X then Ctrl+K > Delete whole snippet > > > --- Shortcuts for jshell tool --- > > For details, see: /help shortcuts > > Tab > Complete Java identifier or jshell command > Shift+Tab then v > Convert expression to variable declaration > Shift+Tab then m > Convert statement to method declaration > Shift+Tab then i > Add imports for this identifier > > > --- More line and history editing --- > > Ctrl+L > Clear screen and reprint snippet > Ctrl+U > Kill whole line > Ctrl+T > Transpose characters > Ctrl+X then Ctrl+B > Navigate to matching bracket, parenthesis, ... > Ctrl+X then = > Enter show current character position mode > Ctrl+X then Ctrl+O > Toggle overwrite characters vs insert characters > Meta+C > Capitalize word > Meta+U > Convert word to uppercase > Meta+L > Convert word to lowercase > Meta+0 through Meta+9 then key > Repeat the specified number of times > > Where, for example, "Ctrl+A" means hold down the control key and press A. > Where "Meta" is "Alt" on many keyboards. > Line editing support is derived from JLine 3. > > _______________________________________________________________________________ > > > > -Robert > > > > On 12/8/18 11:47 AM, Jan Lahoda wrote: >> On 8.12.2018 20:39, Robert Field wrote: >>> Thanks for updating. >>> >>> Good to have /help for line editing keys, however: >>> (1) The supported keys should be listed without requiring that the >>> user knows or looks-up readline. More so, since only some readline keys >>> are supposed. >>> (2) "/edit" is a command, so with this change, typing "/help edit" >>> would give both the /edit and editing help -- which would be confusing. >>> I suggest "/help keys", there are no "k" help items. >> >> Will do. >> >>> (3) In jshell tool online docs the tool is spelled "jshell tool" >>> I'd be happy to write up suggested text. >> >> Thanks, that would be very welcome! >> >>> >>> As to the alternative patch: I understand the motivation, it would be >>> nice to just use the natural "Enter" as new line. Unfortunately it's >>> functionality is then overloaded. I believe the alternative will be >>> confusing and awkward: >>> (1) It breaks backward compatibility in user experience, Enter has >>> always been accept/evaluate >>> (2) It would be very awkward and non-intuitive (particularly in a >>> long multiline snippet) to have to navigate to the end of the snippet to >>> accept. >>> Note: must be the end both vertically and horizontally. >>> (3) It is inconsistent: Mid snippet Enter on one line does accept. >>> However, on a continuation line (say after "int x =") it adds a new line >>> instead. >>> (4) It doesn't solve the problem for the most common location for >>> adding a new line, the end of snippet -- thus introducing more >>> inconsistency. >> >> Ok. This was meant more as a backup in case there's no reasonable >> shortcut we could use to add new lines. >> >> Thanks for the comments! >> >> Jan >> >>> >>> Thanks, >>> Robert >>> >>> >>> On 12/8/18 7:21 AM, Jan Lahoda wrote: >>>> Hi, >>>> >>>> I've updated the patch to reflect the comments so far, the current >>>> version is here: >>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01/ >>>> Delta since the previous version is here for convenience: >>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01/ >>>> >>>> In this version, while editing a snippet, a new line can be added >>>> using Alt-Enter (on platforms that support that), or Ctrl-Enter (on >>>> Windows). >>>> >>>> >>>> And alternative patch is here: >>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01a/ >>>> Delta: >>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01a/ >>>> >>>> In the alternative version, Enter will only "confirm" multi-line >>>> snippet when the cursor is at the end of the snippet, otherwise it >>>> will add a new line (so that a special shortcut is not needed; but a >>>> snippet cannot be "confirmed" by pressing Enter in the middle of a >>>> multi-line snippet.) >>>> >>>> The only difference between the .01 and .01a patches is the way they >>>> allow to add new lines into the multi-line snippets. Other changes are >>>> the same. >>>> >>>> Any feedback on this is welcome. >>>> >>>> Thanks! >>>> >>>> Jan >>>> >>>> On 5.12.2018 18:18, Jan Lahoda wrote: >>>>> Hi Robert, >>>>> >>>>> On 4.12.2018 23:59, Robert Field wrote: >>>>>> I saw no issues with JShell tool and test portions of the webrev. I >>>>>> did >>>>>> not review the nashorn changes. >>>>> >>>>> Thanks for looking at this! >>>>> >>>>>> >>>>>> Testing it: editing multi-line snippets is vastly easier and more >>>>>> intuitive. >>>>>> There is one issue, with the old mechanism, as horridly clunky as it >>>>>> was, you could add new lines of code (a frequently needed >>>>>> functionality). >>>>>> Since is accept, I could find no way to add lines with this >>>>>> JLine 3 version. Thoughts? >>>>> >>>>> One possibility that comes to mind: pressing Enter inside the snippet >>>>> would add a new line, Enter at the very end of a (complete) snippet >>>>> would confirm that snippet. Could be fairly convenient/intuitive. What >>>>> do you think? >>>>> >>>>>> >>>>>> I looked into readline commands as an approach to addressing this, >>>>>> found >>>>>> nothing. However, most readline commands worked. Ctrl-u however did >>>>>> not >>>>>> behave as documented in readline (instead deleting to the >>>>>> beginning of >>>>>> the line). I notice that the there is zero in-command >>>>>> documentation of >>>>>> command-line editing -- not even a mention. Independent from the >>>>>> review >>>>>> of this port, it seems we should have in-command documentation of >>>>>> command editing -- even more so now that multiline editing is useful. >>>>> >>>>> This is about enhancing /help, right? I'll see what I can do. >>>>> >>>>>> >>>>>> The JShell User Manual will also need a little edit in the History >>>>>> Navigation section. >>>>> >>>>> Where is that? >>>>> >>>>> Thanks, >>>>> Jan >>>>> >>>>>> >>>>>> -Robert >>>>>> >>>>>> >>>>>> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>>>>>> Hi, >>>>>>> >>>>>>> I'd like to update the internal JLine used by JShell and jjs to >>>>>>> JLine >>>>>>> 3.9.0. Two notable advantages of this version is multi-line snippet >>>>>>> editing and better UI on Windows (escape sequence support on >>>>>>> Windows). >>>>>>> As a consequence, this patch drops EditingHistory, as it does not >>>>>>> seem >>>>>>> to be needed anymore. >>>>>>> >>>>>>> JBS: >>>>>>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>>>>>> >>>>>>> The full patch is here: >>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>>>>>> >>>>>>> >>>>>>> To make the changes more clear, I've split it into two: >>>>>>> -replacement of existing JLine with the new on in >>>>>>> jdk.internal.le, no >>>>>>> changes to JLine code: >>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>>>>>> >>>>>>> -tweaks to JLine (repackaging, eliminating references to >>>>>>> j.u.l.Logger, >>>>>>> adding hooks to wrap input streams with our stop-detecting input >>>>>>> stream, adding unicode escapes to unicode characters, support for >>>>>>> Windows without JNA), adjustments to JShell and jjs (unfortunately, >>>>>>> 3.9.0 is not compatible with the JLine 2 branch, so the changes are >>>>>>> substantial): >>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>>>>>> >>>>>>> Any feedback is welcome! >>>>>>> >>>>>>> Thanks, >>>>>>> Jan From robert.field at oracle.com Sun Dec 9 15:40:05 2018 From: robert.field at oracle.com (Robert Field) Date: Sun, 09 Dec 2018 07:40:05 -0800 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <5C0D2866.6020105@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> <5C0BE192.8010404@oracle.com> <1fd7c4d3-b446-f695-025e-3ef3c0980744@oracle.com> <5C0C1FBA.2050602@oracle.com> <6eef7f37-897c-7f02-f430-13400cdbc80a@oracle.com> <5C0D2866.6020105@oracle.com> Message-ID: <16793a02408.2794.4011f3a8741ca2aabce58b8b81f42d24@oracle.com> Ok. Go ahead and incorporate the text. I'll make a separate bug to sync the representation of keys in the other help entries. Robert On December 9, 2018 6:36:26 AM Jan Lahoda wrote: > Hi Robert, > > On 9.12.2018 02:40, Robert Field wrote: >> OK, here is my thinking on a /help keys entry. Note: I'm using the > > I think this looks great! > >> representation for keys used by the User's Guide -- which I assume is >> the official tech pubs style -- seems we should be consistent; If we are >> however, the other /help entries should be brought into compliance (they >> seem to be all over the map already). May make sense to spin this off >> as a separate bug, which I'd be happy to take on. > > I'm happy with a separate bug, if you prefer/are OK with that. Or I can > incorporate the text into upgrade patch, whichever you prefer. > > I've updated my current patch with only a rename "editing" -> "keys" and > the fix to the jshell tool name: > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.02/ > > Delta from last: > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.01.02/ > > Jan > >> >> Comments welcome --- >> >> __________________________________________________________________________________________________________________________ >> >> >> /help keys >> ========== >> >> The jshell tool provides line editing support to allow you to navigate >> within and edit snippets and commands. The current command/snippet can >> be edited, or prior commands/snippets can be retrieved from history, >> edited, and executed. This support is similar to readline/editline with >> simple emacs-like bindings. There are also jshell tool specific key >> sequences. >> >> --- Line and history navigation --- >> >> Return >> Enters the current snippet >> Left-arrow or Ctrl+B >> Moves backward one character >> Right-arrow or Ctrl+F >> Moves forward one character >> Up-arrow or Ctrl+P >> Moves up one line, backward through history >> Down arrow or Ctrl+N >> Moves down one line, forward through history >> Ctrl+A >> Moves to the beginning of the line >> Ctrl+E >> Moves to the end of the line >> Meta+B >> Moves backward one word >> Meta+F >> Moves forward one word >> Ctrl+R >> Search backward through history >> >> >> --- Line and history basic editing --- >> >> Meta+Return or Ctrl+Return (depending on platform) >> Insert a new line in snippet >> Ctrl+_ (underscore may require shift key) or Ctrl-X then Ctrl-U >> Undo edit - repeat to undo more edits >> Delete >> Deletes the character at or after the cursor, depending on the >> operating system >> Backspace >> Deletes the character before the cursor >> Ctrl+K >> Deletes the text from the cursor to the end of the line >> Meta+D >> Deletes the text from the cursor to the end of the word >> Ctrl+W >> Deletes the text from the cursor to the previous white space >> Ctrl+Y >> Pastes the most recently deleted text into the line >> Meta+Y >> After Ctrl+Y, Meta+Y cycles through previously deleted text >> Ctrl+X then Ctrl+K >> Delete whole snippet >> >> >> --- Shortcuts for jshell tool --- >> >> For details, see: /help shortcuts >> >> Tab >> Complete Java identifier or jshell command >> Shift+Tab then v >> Convert expression to variable declaration >> Shift+Tab then m >> Convert statement to method declaration >> Shift+Tab then i >> Add imports for this identifier >> >> >> --- More line and history editing --- >> >> Ctrl+L >> Clear screen and reprint snippet >> Ctrl+U >> Kill whole line >> Ctrl+T >> Transpose characters >> Ctrl+X then Ctrl+B >> Navigate to matching bracket, parenthesis, ... >> Ctrl+X then = >> Enter show current character position mode >> Ctrl+X then Ctrl+O >> Toggle overwrite characters vs insert characters >> Meta+C >> Capitalize word >> Meta+U >> Convert word to uppercase >> Meta+L >> Convert word to lowercase >> Meta+0 through Meta+9 then key >> Repeat the specified number of times >> >> Where, for example, "Ctrl+A" means hold down the control key and press A. >> Where "Meta" is "Alt" on many keyboards. >> Line editing support is derived from JLine 3. >> >> _______________________________________________________________________________ >> >> >> >> -Robert >> >> >> >> On 12/8/18 11:47 AM, Jan Lahoda wrote: >>> On 8.12.2018 20:39, Robert Field wrote: >>>> Thanks for updating. >>>> >>>> Good to have /help for line editing keys, however: >>>> (1) The supported keys should be listed without requiring that the >>>> user knows or looks-up readline. More so, since only some readline keys >>>> are supposed. >>>> (2) "/edit" is a command, so with this change, typing "/help edit" >>>> would give both the /edit and editing help -- which would be confusing. >>>> I suggest "/help keys", there are no "k" help items. >>> >>> Will do. >>> >>>> (3) In jshell tool online docs the tool is spelled "jshell tool" >>>> I'd be happy to write up suggested text. >>> >>> Thanks, that would be very welcome! >>> >>>> >>>> As to the alternative patch: I understand the motivation, it would be >>>> nice to just use the natural "Enter" as new line. Unfortunately it's >>>> functionality is then overloaded. I believe the alternative will be >>>> confusing and awkward: >>>> (1) It breaks backward compatibility in user experience, Enter has >>>> always been accept/evaluate >>>> (2) It would be very awkward and non-intuitive (particularly in a >>>> long multiline snippet) to have to navigate to the end of the snippet to >>>> accept. >>>> Note: must be the end both vertically and horizontally. >>>> (3) It is inconsistent: Mid snippet Enter on one line does accept. >>>> However, on a continuation line (say after "int x =") it adds a new line >>>> instead. >>>> (4) It doesn't solve the problem for the most common location for >>>> adding a new line, the end of snippet -- thus introducing more >>>> inconsistency. >>> >>> Ok. This was meant more as a backup in case there's no reasonable >>> shortcut we could use to add new lines. >>> >>> Thanks for the comments! >>> >>> Jan >>> >>>> >>>> Thanks, >>>> Robert >>>> >>>> >>>> On 12/8/18 7:21 AM, Jan Lahoda wrote: >>>>> Hi, >>>>> >>>>> I've updated the patch to reflect the comments so far, the current >>>>> version is here: >>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01/ >>>>> Delta since the previous version is here for convenience: >>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01/ >>>>> >>>>> In this version, while editing a snippet, a new line can be added >>>>> using Alt-Enter (on platforms that support that), or Ctrl-Enter (on >>>>> Windows). >>>>> >>>>> >>>>> And alternative patch is here: >>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01a/ >>>>> Delta: >>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01a/ >>>>> >>>>> In the alternative version, Enter will only "confirm" multi-line >>>>> snippet when the cursor is at the end of the snippet, otherwise it >>>>> will add a new line (so that a special shortcut is not needed; but a >>>>> snippet cannot be "confirmed" by pressing Enter in the middle of a >>>>> multi-line snippet.) >>>>> >>>>> The only difference between the .01 and .01a patches is the way they >>>>> allow to add new lines into the multi-line snippets. Other changes are >>>>> the same. >>>>> >>>>> Any feedback on this is welcome. >>>>> >>>>> Thanks! >>>>> >>>>> Jan >>>>> >>>>> On 5.12.2018 18:18, Jan Lahoda wrote: >>>>>> Hi Robert, >>>>>> >>>>>> On 4.12.2018 23:59, Robert Field wrote: >>>>>>> I saw no issues with JShell tool and test portions of the webrev. I >>>>>>> did >>>>>>> not review the nashorn changes. >>>>>> >>>>>> Thanks for looking at this! >>>>>> >>>>>>> >>>>>>> Testing it: editing multi-line snippets is vastly easier and more >>>>>>> intuitive. >>>>>>> There is one issue, with the old mechanism, as horridly clunky as it >>>>>>> was, you could add new lines of code (a frequently needed >>>>>>> functionality). >>>>>>> Since is accept, I could find no way to add lines with this >>>>>>> JLine 3 version. Thoughts? >>>>>> >>>>>> One possibility that comes to mind: pressing Enter inside the snippet >>>>>> would add a new line, Enter at the very end of a (complete) snippet >>>>>> would confirm that snippet. Could be fairly convenient/intuitive. What >>>>>> do you think? >>>>>> >>>>>>> >>>>>>> I looked into readline commands as an approach to addressing this, >>>>>>> found >>>>>>> nothing. However, most readline commands worked. Ctrl-u however did >>>>>>> not >>>>>>> behave as documented in readline (instead deleting to the >>>>>>> beginning of >>>>>>> the line). I notice that the there is zero in-command >>>>>>> documentation of >>>>>>> command-line editing -- not even a mention. Independent from the >>>>>>> review >>>>>>> of this port, it seems we should have in-command documentation of >>>>>>> command editing -- even more so now that multiline editing is useful. >>>>>> >>>>>> This is about enhancing /help, right? I'll see what I can do. >>>>>> >>>>>>> >>>>>>> The JShell User Manual will also need a little edit in the History >>>>>>> Navigation section. >>>>>> >>>>>> Where is that? >>>>>> >>>>>> Thanks, >>>>>> Jan >>>>>> >>>>>>> >>>>>>> -Robert >>>>>>> >>>>>>> >>>>>>> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>>>>>>> Hi, >>>>>>>> >>>>>>>> I'd like to update the internal JLine used by JShell and jjs to >>>>>>>> JLine >>>>>>>> 3.9.0. Two notable advantages of this version is multi-line snippet >>>>>>>> editing and better UI on Windows (escape sequence support on >>>>>>>> Windows). >>>>>>>> As a consequence, this patch drops EditingHistory, as it does not >>>>>>>> seem >>>>>>>> to be needed anymore. >>>>>>>> >>>>>>>> JBS: >>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>>>>>>> >>>>>>>> The full patch is here: >>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>>>>>>> >>>>>>>> >>>>>>>> To make the changes more clear, I've split it into two: >>>>>>>> -replacement of existing JLine with the new on in >>>>>>>> jdk.internal.le, no >>>>>>>> changes to JLine code: >>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>>>>>>> >>>>>>>> -tweaks to JLine (repackaging, eliminating references to >>>>>>>> j.u.l.Logger, >>>>>>>> adding hooks to wrap input streams with our stop-detecting input >>>>>>>> stream, adding unicode escapes to unicode characters, support for >>>>>>>> Windows without JNA), adjustments to JShell and jjs (unfortunately, >>>>>>>> 3.9.0 is not compatible with the JLine 2 branch, so the changes are >>>>>>>> substantial): >>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>>>>>>> >>>>>>>> Any feedback is welcome! >>>>>>>> >>>>>>>> Thanks, >>>>>>>> Jan From jan.lahoda at oracle.com Sun Dec 9 22:45:46 2018 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Sun, 9 Dec 2018 23:45:46 +0100 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <16793a02408.2794.4011f3a8741ca2aabce58b8b81f42d24@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> <5C0BE192.8010404@oracle.com> <1fd7c4d3-b446-f695-025e-3ef3c0980744@oracle.com> <5C0C1FBA.2050602@oracle.com> <6eef7f37-897c-7f02-f430-13400cdbc80a@oracle.com> <5C0D2866.6020105@oracle.com> <16793a02408.2794.4011f3a8741ca2aabce58b8b81f42d24@oracle.com> Message-ID: <5C0D9B1A.3080409@oracle.com> On 9.12.2018 16:40, Robert Field wrote: > Ok. Go ahead and incorporate the text. I'll make a separate bug to sync > the representation of keys in the other help entries. An updated patch (with your text): http://cr.openjdk.java.net/~jlahoda/8214491/webrev.03/ Delta from previous patch: http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.02.03/ Thanks for the comments and for the text! Any feedback is welcome. Thanks, Jan > > Robert > > > On December 9, 2018 6:36:26 AM Jan Lahoda wrote: > >> Hi Robert, >> >> On 9.12.2018 02:40, Robert Field wrote: >>> OK, here is my thinking on a /help keys entry. Note: I'm using the >> >> I think this looks great! >> >>> representation for keys used by the User's Guide -- which I assume is >>> the official tech pubs style -- seems we should be consistent; If we are >>> however, the other /help entries should be brought into compliance (they >>> seem to be all over the map already). May make sense to spin this off >>> as a separate bug, which I'd be happy to take on. >> >> I'm happy with a separate bug, if you prefer/are OK with that. Or I can >> incorporate the text into upgrade patch, whichever you prefer. >> >> I've updated my current patch with only a rename "editing" -> "keys" and >> the fix to the jshell tool name: >> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.02/ >> >> Delta from last: >> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.01.02/ >> >> Jan >> >>> >>> Comments welcome --- >>> >>> __________________________________________________________________________________________________________________________ >>> >>> >>> >>> /help keys >>> ========== >>> >>> The jshell tool provides line editing support to allow you to navigate >>> within and edit snippets and commands. The current command/snippet can >>> be edited, or prior commands/snippets can be retrieved from history, >>> edited, and executed. This support is similar to readline/editline with >>> simple emacs-like bindings. There are also jshell tool specific key >>> sequences. >>> >>> --- Line and history navigation --- >>> >>> Return >>> Enters the current snippet >>> Left-arrow or Ctrl+B >>> Moves backward one character >>> Right-arrow or Ctrl+F >>> Moves forward one character >>> Up-arrow or Ctrl+P >>> Moves up one line, backward through history >>> Down arrow or Ctrl+N >>> Moves down one line, forward through history >>> Ctrl+A >>> Moves to the beginning of the line >>> Ctrl+E >>> Moves to the end of the line >>> Meta+B >>> Moves backward one word >>> Meta+F >>> Moves forward one word >>> Ctrl+R >>> Search backward through history >>> >>> >>> --- Line and history basic editing --- >>> >>> Meta+Return or Ctrl+Return (depending on platform) >>> Insert a new line in snippet >>> Ctrl+_ (underscore may require shift key) or Ctrl-X then Ctrl-U >>> Undo edit - repeat to undo more edits >>> Delete >>> Deletes the character at or after the cursor, depending on the >>> operating system >>> Backspace >>> Deletes the character before the cursor >>> Ctrl+K >>> Deletes the text from the cursor to the end of the line >>> Meta+D >>> Deletes the text from the cursor to the end of the word >>> Ctrl+W >>> Deletes the text from the cursor to the previous white space >>> Ctrl+Y >>> Pastes the most recently deleted text into the line >>> Meta+Y >>> After Ctrl+Y, Meta+Y cycles through previously deleted text >>> Ctrl+X then Ctrl+K >>> Delete whole snippet >>> >>> >>> --- Shortcuts for jshell tool --- >>> >>> For details, see: /help shortcuts >>> >>> Tab >>> Complete Java identifier or jshell command >>> Shift+Tab then v >>> Convert expression to variable declaration >>> Shift+Tab then m >>> Convert statement to method declaration >>> Shift+Tab then i >>> Add imports for this identifier >>> >>> >>> --- More line and history editing --- >>> >>> Ctrl+L >>> Clear screen and reprint snippet >>> Ctrl+U >>> Kill whole line >>> Ctrl+T >>> Transpose characters >>> Ctrl+X then Ctrl+B >>> Navigate to matching bracket, parenthesis, ... >>> Ctrl+X then = >>> Enter show current character position mode >>> Ctrl+X then Ctrl+O >>> Toggle overwrite characters vs insert characters >>> Meta+C >>> Capitalize word >>> Meta+U >>> Convert word to uppercase >>> Meta+L >>> Convert word to lowercase >>> Meta+0 through Meta+9 then key >>> Repeat the specified number of times >>> >>> Where, for example, "Ctrl+A" means hold down the control key and >>> press A. >>> Where "Meta" is "Alt" on many keyboards. >>> Line editing support is derived from JLine 3. >>> >>> _______________________________________________________________________________ >>> >>> >>> >>> >>> -Robert >>> >>> >>> >>> On 12/8/18 11:47 AM, Jan Lahoda wrote: >>>> On 8.12.2018 20:39, Robert Field wrote: >>>>> Thanks for updating. >>>>> >>>>> Good to have /help for line editing keys, however: >>>>> (1) The supported keys should be listed without requiring that the >>>>> user knows or looks-up readline. More so, since only some readline >>>>> keys >>>>> are supposed. >>>>> (2) "/edit" is a command, so with this change, typing "/help edit" >>>>> would give both the /edit and editing help -- which would be >>>>> confusing. >>>>> I suggest "/help keys", there are no "k" help items. >>>> >>>> Will do. >>>> >>>>> (3) In jshell tool online docs the tool is spelled "jshell tool" >>>>> I'd be happy to write up suggested text. >>>> >>>> Thanks, that would be very welcome! >>>> >>>>> >>>>> As to the alternative patch: I understand the motivation, it would be >>>>> nice to just use the natural "Enter" as new line. Unfortunately it's >>>>> functionality is then overloaded. I believe the alternative will be >>>>> confusing and awkward: >>>>> (1) It breaks backward compatibility in user experience, Enter has >>>>> always been accept/evaluate >>>>> (2) It would be very awkward and non-intuitive (particularly in a >>>>> long multiline snippet) to have to navigate to the end of the >>>>> snippet to >>>>> accept. >>>>> Note: must be the end both vertically and horizontally. >>>>> (3) It is inconsistent: Mid snippet Enter on one line does accept. >>>>> However, on a continuation line (say after "int x =") it adds a new >>>>> line >>>>> instead. >>>>> (4) It doesn't solve the problem for the most common location for >>>>> adding a new line, the end of snippet -- thus introducing more >>>>> inconsistency. >>>> >>>> Ok. This was meant more as a backup in case there's no reasonable >>>> shortcut we could use to add new lines. >>>> >>>> Thanks for the comments! >>>> >>>> Jan >>>> >>>>> >>>>> Thanks, >>>>> Robert >>>>> >>>>> >>>>> On 12/8/18 7:21 AM, Jan Lahoda wrote: >>>>>> Hi, >>>>>> >>>>>> I've updated the patch to reflect the comments so far, the current >>>>>> version is here: >>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01/ >>>>>> Delta since the previous version is here for convenience: >>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01/ >>>>>> >>>>>> In this version, while editing a snippet, a new line can be added >>>>>> using Alt-Enter (on platforms that support that), or Ctrl-Enter (on >>>>>> Windows). >>>>>> >>>>>> >>>>>> And alternative patch is here: >>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01a/ >>>>>> Delta: >>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01a/ >>>>>> >>>>>> In the alternative version, Enter will only "confirm" multi-line >>>>>> snippet when the cursor is at the end of the snippet, otherwise it >>>>>> will add a new line (so that a special shortcut is not needed; but a >>>>>> snippet cannot be "confirmed" by pressing Enter in the middle of a >>>>>> multi-line snippet.) >>>>>> >>>>>> The only difference between the .01 and .01a patches is the way they >>>>>> allow to add new lines into the multi-line snippets. Other changes >>>>>> are >>>>>> the same. >>>>>> >>>>>> Any feedback on this is welcome. >>>>>> >>>>>> Thanks! >>>>>> >>>>>> Jan >>>>>> >>>>>> On 5.12.2018 18:18, Jan Lahoda wrote: >>>>>>> Hi Robert, >>>>>>> >>>>>>> On 4.12.2018 23:59, Robert Field wrote: >>>>>>>> I saw no issues with JShell tool and test portions of the >>>>>>>> webrev. I >>>>>>>> did >>>>>>>> not review the nashorn changes. >>>>>>> >>>>>>> Thanks for looking at this! >>>>>>> >>>>>>>> >>>>>>>> Testing it: editing multi-line snippets is vastly easier and more >>>>>>>> intuitive. >>>>>>>> There is one issue, with the old mechanism, as horridly clunky >>>>>>>> as it >>>>>>>> was, you could add new lines of code (a frequently needed >>>>>>>> functionality). >>>>>>>> Since is accept, I could find no way to add lines with >>>>>>>> this >>>>>>>> JLine 3 version. Thoughts? >>>>>>> >>>>>>> One possibility that comes to mind: pressing Enter inside the >>>>>>> snippet >>>>>>> would add a new line, Enter at the very end of a (complete) snippet >>>>>>> would confirm that snippet. Could be fairly convenient/intuitive. >>>>>>> What >>>>>>> do you think? >>>>>>> >>>>>>>> >>>>>>>> I looked into readline commands as an approach to addressing this, >>>>>>>> found >>>>>>>> nothing. However, most readline commands worked. Ctrl-u however >>>>>>>> did >>>>>>>> not >>>>>>>> behave as documented in readline (instead deleting to the >>>>>>>> beginning of >>>>>>>> the line). I notice that the there is zero in-command >>>>>>>> documentation of >>>>>>>> command-line editing -- not even a mention. Independent from the >>>>>>>> review >>>>>>>> of this port, it seems we should have in-command documentation of >>>>>>>> command editing -- even more so now that multiline editing is >>>>>>>> useful. >>>>>>> >>>>>>> This is about enhancing /help, right? I'll see what I can do. >>>>>>> >>>>>>>> >>>>>>>> The JShell User Manual will also need a little edit in the History >>>>>>>> Navigation section. >>>>>>> >>>>>>> Where is that? >>>>>>> >>>>>>> Thanks, >>>>>>> Jan >>>>>>> >>>>>>>> >>>>>>>> -Robert >>>>>>>> >>>>>>>> >>>>>>>> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> I'd like to update the internal JLine used by JShell and jjs to >>>>>>>>> JLine >>>>>>>>> 3.9.0. Two notable advantages of this version is multi-line >>>>>>>>> snippet >>>>>>>>> editing and better UI on Windows (escape sequence support on >>>>>>>>> Windows). >>>>>>>>> As a consequence, this patch drops EditingHistory, as it does not >>>>>>>>> seem >>>>>>>>> to be needed anymore. >>>>>>>>> >>>>>>>>> JBS: >>>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>>>>>>>> >>>>>>>>> The full patch is here: >>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>>>>>>>> >>>>>>>>> >>>>>>>>> To make the changes more clear, I've split it into two: >>>>>>>>> -replacement of existing JLine with the new on in >>>>>>>>> jdk.internal.le, no >>>>>>>>> changes to JLine code: >>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>>>>>>>> >>>>>>>>> -tweaks to JLine (repackaging, eliminating references to >>>>>>>>> j.u.l.Logger, >>>>>>>>> adding hooks to wrap input streams with our stop-detecting input >>>>>>>>> stream, adding unicode escapes to unicode characters, support for >>>>>>>>> Windows without JNA), adjustments to JShell and jjs >>>>>>>>> (unfortunately, >>>>>>>>> 3.9.0 is not compatible with the JLine 2 branch, so the changes >>>>>>>>> are >>>>>>>>> substantial): >>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>>>>>>>> >>>>>>>>> Any feedback is welcome! >>>>>>>>> >>>>>>>>> Thanks, >>>>>>>>> Jan > > > From robert.field at oracle.com Sun Dec 9 23:08:28 2018 From: robert.field at oracle.com (Robert Field) Date: Sun, 9 Dec 2018 15:08:28 -0800 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <5C0D9B1A.3080409@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> <5C0BE192.8010404@oracle.com> <1fd7c4d3-b446-f695-025e-3ef3c0980744@oracle.com> <5C0C1FBA.2050602@oracle.com> <6eef7f37-897c-7f02-f430-13400cdbc80a@oracle.com> <5C0D2866.6020105@oracle.com> <16793a02408.2794.4011f3a8741ca2aabce58b8b81f42d24@oracle.com> <5C0D9B1A.3080409@oracle.com> Message-ID: <203ab488-dba6-dbd7-2de5-10e847bd581f@oracle.com> Thumbs up! -Robert On 12/9/18 2:45 PM, Jan Lahoda wrote: > On 9.12.2018 16:40, Robert Field wrote: >> Ok. Go ahead and incorporate the text. I'll make a separate bug to sync >> the representation of keys in the other help entries. > > An updated patch (with your text): > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.03/ > Delta from previous patch: > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.02.03/ > > Thanks for the comments and for the text! Any feedback is welcome. > > Thanks, > ??? Jan > > >> >> Robert >> >> >> On December 9, 2018 6:36:26 AM Jan Lahoda wrote: >> >>> Hi Robert, >>> >>> On 9.12.2018 02:40, Robert Field wrote: >>>> OK, here is my thinking on a /help keys entry.? Note: I'm using the >>> >>> I think this looks great! >>> >>>> representation for keys used by the User's Guide -- which I assume is >>>> the official tech pubs style -- seems we should be consistent; If >>>> we are >>>> however, the other /help entries should be brought into compliance >>>> (they >>>> seem to be all over the map already).? May make sense to spin this off >>>> as a separate bug, which I'd be happy to take on. >>> >>> I'm happy with a separate bug, if you prefer/are OK with that. Or I can >>> incorporate the text into upgrade patch, whichever you prefer. >>> >>> I've updated my current patch with only a rename "editing" -> "keys" >>> and >>> the fix to the jshell tool name: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.02/ >>> >>> Delta from last: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.01.02/ >>> >>> Jan >>> >>>> >>>> Comments welcome --- >>>> >>>> __________________________________________________________________________________________________________________________ >>>> >>>> >>>> >>>> >>>> /help keys >>>> ========== >>>> >>>> The jshell tool provides line editing support to allow you to navigate >>>> within and edit snippets and commands. The current command/snippet can >>>> be edited, or prior commands/snippets can be retrieved from history, >>>> edited, and executed. This support is similar to readline/editline >>>> with >>>> simple emacs-like bindings.? There are also jshell tool specific key >>>> sequences. >>>> >>>> --- Line and history navigation --- >>>> >>>> Return >>>> ?? Enters the current snippet >>>> Left-arrow or Ctrl+B >>>> ?? Moves backward one character >>>> Right-arrow or Ctrl+F >>>> ?? Moves forward one character >>>> Up-arrow or Ctrl+P >>>> ?? Moves up one line, backward through history >>>> Down arrow or Ctrl+N >>>> ?? Moves down one line, forward through history >>>> Ctrl+A >>>> ?? Moves to the beginning of the line >>>> Ctrl+E >>>> ?? Moves to the end of the line >>>> Meta+B >>>> ?? Moves backward one word >>>> Meta+F >>>> ?? Moves forward one word >>>> Ctrl+R >>>> ?? Search backward through history >>>> >>>> >>>> --- Line and history basic editing --- >>>> >>>> Meta+Return or Ctrl+Return (depending on platform) >>>> ?? Insert a new line in snippet >>>> Ctrl+_ (underscore may require shift key) or Ctrl-X then Ctrl-U >>>> ?? Undo edit - repeat to undo more edits >>>> Delete >>>> ?? Deletes the character at or after the cursor, depending on the >>>> operating system >>>> Backspace >>>> ?? Deletes the character before the cursor >>>> Ctrl+K >>>> ?? Deletes the text from the cursor to the end of the line >>>> Meta+D >>>> ?? Deletes the text from the cursor to the end of the word >>>> Ctrl+W >>>> ?? Deletes the text from the cursor to the previous white space >>>> Ctrl+Y >>>> ?? Pastes the most recently deleted text into the line >>>> Meta+Y >>>> ?? After Ctrl+Y, Meta+Y cycles through previously deleted text >>>> Ctrl+X then Ctrl+K >>>> ?? Delete whole snippet >>>> >>>> >>>> --- Shortcuts for jshell tool --- >>>> >>>> For details, see: /help shortcuts >>>> >>>> Tab >>>> ?? Complete Java identifier or jshell command >>>> Shift+Tab then v >>>> ?? Convert expression to variable declaration >>>> Shift+Tab then m >>>> ?? Convert statement to method declaration >>>> Shift+Tab then i >>>> ?? Add imports for this identifier >>>> >>>> >>>> --- More line and history editing --- >>>> >>>> Ctrl+L >>>> ?? Clear screen and reprint snippet >>>> Ctrl+U >>>> ?? Kill whole line >>>> Ctrl+T >>>> ?? Transpose characters >>>> Ctrl+X then Ctrl+B >>>> ?? Navigate to matching bracket, parenthesis, ... >>>> Ctrl+X then = >>>> ?? Enter show current character position mode >>>> Ctrl+X then Ctrl+O >>>> ?? Toggle overwrite characters vs insert characters >>>> Meta+C >>>> ?? Capitalize word >>>> Meta+U >>>> ?? Convert word to uppercase >>>> Meta+L >>>> ?? Convert word to lowercase >>>> Meta+0 through Meta+9 then key >>>> ?? Repeat the specified number of times >>>> >>>> Where, for example, "Ctrl+A" means hold down the control key and >>>> press A. >>>> Where "Meta" is "Alt" on many keyboards. >>>> Line editing support is derived from JLine 3. >>>> >>>> _______________________________________________________________________________ >>>> >>>> >>>> >>>> >>>> >>>> -Robert >>>> >>>> >>>> >>>> On 12/8/18 11:47 AM, Jan Lahoda wrote: >>>>> On 8.12.2018 20:39, Robert Field wrote: >>>>>> Thanks for updating. >>>>>> >>>>>> Good to have /help for line editing keys, however: >>>>>> ?? (1) The supported keys should be listed without requiring that >>>>>> the >>>>>> user knows or looks-up readline. More so, since only some readline >>>>>> keys >>>>>> are supposed. >>>>>> ?? (2) "/edit" is a command, so with this change, typing "/help >>>>>> edit" >>>>>> would give both the /edit and editing help -- which would be >>>>>> confusing. >>>>>> I suggest "/help keys", there are no "k" help items. >>>>> >>>>> Will do. >>>>> >>>>>> ?? (3) In jshell tool online docs the tool is spelled "jshell tool" >>>>>> I'd be happy to write up suggested text. >>>>> >>>>> Thanks, that would be very welcome! >>>>> >>>>>> >>>>>> As to the alternative patch: I understand the motivation, it >>>>>> would be >>>>>> nice to just use the natural "Enter" as new line. Unfortunately it's >>>>>> functionality is then overloaded.? I believe the alternative will be >>>>>> confusing and awkward: >>>>>> ?? (1) It breaks backward compatibility in user experience, Enter >>>>>> has >>>>>> always been accept/evaluate >>>>>> ?? (2) It would be very awkward and non-intuitive (particularly in a >>>>>> long multiline snippet) to have to navigate to the end of the >>>>>> snippet to >>>>>> accept. >>>>>> ??????? Note: must be the end both vertically and horizontally. >>>>>> ?? (3) It is inconsistent: Mid snippet Enter on one line does >>>>>> accept. >>>>>> However, on a continuation line (say after "int x =") it adds a new >>>>>> line >>>>>> instead. >>>>>> ?? (4) It doesn't solve the problem for the most common location for >>>>>> adding a new line, the end of snippet -- thus introducing more >>>>>> inconsistency. >>>>> >>>>> Ok. This was meant more as a backup in case there's no reasonable >>>>> shortcut we could use to add new lines. >>>>> >>>>> Thanks for the comments! >>>>> >>>>> Jan >>>>> >>>>>> >>>>>> Thanks, >>>>>> Robert >>>>>> >>>>>> >>>>>> On 12/8/18 7:21 AM, Jan Lahoda wrote: >>>>>>> Hi, >>>>>>> >>>>>>> I've updated the patch to reflect the comments so far, the current >>>>>>> version is here: >>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01/ >>>>>>> Delta since the previous version is here for convenience: >>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01/ >>>>>>> >>>>>>> In this version, while editing a snippet, a new line can be added >>>>>>> using Alt-Enter (on platforms that support that), or Ctrl-Enter (on >>>>>>> Windows). >>>>>>> >>>>>>> >>>>>>> And alternative patch is here: >>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01a/ >>>>>>> Delta: >>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01a/ >>>>>>> >>>>>>> In the alternative version, Enter will only "confirm" multi-line >>>>>>> snippet when the cursor is at the end of the snippet, otherwise it >>>>>>> will add a new line (so that a special shortcut is not needed; >>>>>>> but a >>>>>>> snippet cannot be "confirmed" by pressing Enter in the middle of a >>>>>>> multi-line snippet.) >>>>>>> >>>>>>> The only difference between the .01 and .01a patches is the way >>>>>>> they >>>>>>> allow to add new lines into the multi-line snippets. Other changes >>>>>>> are >>>>>>> the same. >>>>>>> >>>>>>> Any feedback on this is welcome. >>>>>>> >>>>>>> Thanks! >>>>>>> >>>>>>> Jan >>>>>>> >>>>>>> On 5.12.2018 18:18, Jan Lahoda wrote: >>>>>>>> Hi Robert, >>>>>>>> >>>>>>>> On 4.12.2018 23:59, Robert Field wrote: >>>>>>>>> I saw no issues with JShell tool and test portions of the >>>>>>>>> webrev.? I >>>>>>>>> did >>>>>>>>> not review the nashorn changes. >>>>>>>> >>>>>>>> Thanks for looking at this! >>>>>>>> >>>>>>>>> >>>>>>>>> Testing it: editing multi-line snippets is vastly easier and more >>>>>>>>> intuitive. >>>>>>>>> There is one issue, with the old mechanism, as horridly clunky >>>>>>>>> as it >>>>>>>>> was, you could add new lines of code (a frequently needed >>>>>>>>> functionality). >>>>>>>>> Since is accept, I could find no way to add lines with >>>>>>>>> this >>>>>>>>> JLine 3 version.? Thoughts? >>>>>>>> >>>>>>>> One possibility that comes to mind: pressing Enter inside the >>>>>>>> snippet >>>>>>>> would add a new line, Enter at the very end of a (complete) >>>>>>>> snippet >>>>>>>> would confirm that snippet. Could be fairly convenient/intuitive. >>>>>>>> What >>>>>>>> do you think? >>>>>>>> >>>>>>>>> >>>>>>>>> I looked into readline commands as an approach to addressing >>>>>>>>> this, >>>>>>>>> found >>>>>>>>> nothing.? However, most readline commands worked. Ctrl-u however >>>>>>>>> did >>>>>>>>> not >>>>>>>>> behave as documented in readline (instead deleting to the >>>>>>>>> beginning of >>>>>>>>> the line).? I notice that the there is zero in-command >>>>>>>>> documentation of >>>>>>>>> command-line editing -- not even a mention. Independent from the >>>>>>>>> review >>>>>>>>> of this port, it seems we should have in-command documentation of >>>>>>>>> command editing -- even more so now that multiline editing is >>>>>>>>> useful. >>>>>>>> >>>>>>>> This is about enhancing /help, right? I'll see what I can do. >>>>>>>> >>>>>>>>> >>>>>>>>> The JShell User Manual will also need a little edit in the >>>>>>>>> History >>>>>>>>> Navigation section. >>>>>>>> >>>>>>>> Where is that? >>>>>>>> >>>>>>>> Thanks, >>>>>>>> ???? Jan >>>>>>>> >>>>>>>>> >>>>>>>>> -Robert >>>>>>>>> >>>>>>>>> >>>>>>>>> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>>>>>>>>> Hi, >>>>>>>>>> >>>>>>>>>> I'd like to update the internal JLine used by JShell and jjs to >>>>>>>>>> JLine >>>>>>>>>> 3.9.0. Two notable advantages of this version is multi-line >>>>>>>>>> snippet >>>>>>>>>> editing and better UI on Windows (escape sequence support on >>>>>>>>>> Windows). >>>>>>>>>> As a consequence, this patch drops EditingHistory, as it does >>>>>>>>>> not >>>>>>>>>> seem >>>>>>>>>> to be needed anymore. >>>>>>>>>> >>>>>>>>>> JBS: >>>>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>>>>>>>>> >>>>>>>>>> The full patch is here: >>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> To make the changes more clear, I've split it into two: >>>>>>>>>> -replacement of existing JLine with the new on in >>>>>>>>>> jdk.internal.le, no >>>>>>>>>> changes to JLine code: >>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>>>>>>>>> >>>>>>>>>> -tweaks to JLine (repackaging, eliminating references to >>>>>>>>>> j.u.l.Logger, >>>>>>>>>> adding hooks to wrap input streams with our stop-detecting input >>>>>>>>>> stream, adding unicode escapes to unicode characters, support >>>>>>>>>> for >>>>>>>>>> Windows without JNA), adjustments to JShell and jjs >>>>>>>>>> (unfortunately, >>>>>>>>>> 3.9.0 is not compatible with the JLine 2 branch, so the changes >>>>>>>>>> are >>>>>>>>>> substantial): >>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>>>>>>>>> >>>>>>>>>> Any feedback is welcome! >>>>>>>>>> >>>>>>>>>> Thanks, >>>>>>>>>> ??? Jan >> >> >> From sundararajan.athijegannathan at oracle.com Mon Dec 10 05:20:31 2018 From: sundararajan.athijegannathan at oracle.com (Sundararajan Athijegannathan) Date: Mon, 10 Dec 2018 10:50:31 +0530 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <5C0D9B1A.3080409@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> <5C0BE192.8010404@oracle.com> <1fd7c4d3-b446-f695-025e-3ef3c0980744@oracle.com> <5C0C1FBA.2050602@oracle.com> <6eef7f37-897c-7f02-f430-13400cdbc80a@oracle.com> <5C0D2866.6020105@oracle.com> <16793a02408.2794.4011f3a8741ca2aabce58b8b81f42d24@oracle.com> <5C0D9B1A.3080409@oracle.com> Message-ID: <5C0DF79F.7050500@oracle.com> I built jdk and ran nashorn tests with this patch. Two tests fail with this patch - but those tests pass without this patch: [testng] Test test/nashorn/script/nosecurity/JDK-8055034.js failed at line 1 - [testng] expected: 'jjs> var x = Object.create(null);' [testng] found: 'jjs> var x = Object.create(null)jjs> jjs> print('PASSED')PASSED' [testng] Test test/nashorn/script/nosecurity/JDK-8130127.js failed at line 5 - [testng] expected: 'jjs> print('hello')' [testng] found: 'jjs> print('hello')hello' Both tests involving exec'ing jjs and comparing with the expected output. Either we need to add these to failing tests and/or address the issue before push. Thanks, -Sundar On 10/12/18, 4:15 AM, Jan Lahoda wrote: > On 9.12.2018 16:40, Robert Field wrote: >> Ok. Go ahead and incorporate the text. I'll make a separate bug to sync >> the representation of keys in the other help entries. > > An updated patch (with your text): > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.03/ > Delta from previous patch: > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.02.03/ > > Thanks for the comments and for the text! Any feedback is welcome. > > Thanks, > Jan > > >> >> Robert >> >> >> On December 9, 2018 6:36:26 AM Jan Lahoda wrote: >> >>> Hi Robert, >>> >>> On 9.12.2018 02:40, Robert Field wrote: >>>> OK, here is my thinking on a /help keys entry. Note: I'm using the >>> >>> I think this looks great! >>> >>>> representation for keys used by the User's Guide -- which I assume is >>>> the official tech pubs style -- seems we should be consistent; If >>>> we are >>>> however, the other /help entries should be brought into compliance >>>> (they >>>> seem to be all over the map already). May make sense to spin this off >>>> as a separate bug, which I'd be happy to take on. >>> >>> I'm happy with a separate bug, if you prefer/are OK with that. Or I can >>> incorporate the text into upgrade patch, whichever you prefer. >>> >>> I've updated my current patch with only a rename "editing" -> "keys" >>> and >>> the fix to the jshell tool name: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.02/ >>> >>> Delta from last: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.01.02/ >>> >>> Jan >>> >>>> >>>> Comments welcome --- >>>> >>>> __________________________________________________________________________________________________________________________ >>>> >>>> >>>> >>>> >>>> /help keys >>>> ========== >>>> >>>> The jshell tool provides line editing support to allow you to navigate >>>> within and edit snippets and commands. The current command/snippet can >>>> be edited, or prior commands/snippets can be retrieved from history, >>>> edited, and executed. This support is similar to readline/editline >>>> with >>>> simple emacs-like bindings. There are also jshell tool specific key >>>> sequences. >>>> >>>> --- Line and history navigation --- >>>> >>>> Return >>>> Enters the current snippet >>>> Left-arrow or Ctrl+B >>>> Moves backward one character >>>> Right-arrow or Ctrl+F >>>> Moves forward one character >>>> Up-arrow or Ctrl+P >>>> Moves up one line, backward through history >>>> Down arrow or Ctrl+N >>>> Moves down one line, forward through history >>>> Ctrl+A >>>> Moves to the beginning of the line >>>> Ctrl+E >>>> Moves to the end of the line >>>> Meta+B >>>> Moves backward one word >>>> Meta+F >>>> Moves forward one word >>>> Ctrl+R >>>> Search backward through history >>>> >>>> >>>> --- Line and history basic editing --- >>>> >>>> Meta+Return or Ctrl+Return (depending on platform) >>>> Insert a new line in snippet >>>> Ctrl+_ (underscore may require shift key) or Ctrl-X then Ctrl-U >>>> Undo edit - repeat to undo more edits >>>> Delete >>>> Deletes the character at or after the cursor, depending on the >>>> operating system >>>> Backspace >>>> Deletes the character before the cursor >>>> Ctrl+K >>>> Deletes the text from the cursor to the end of the line >>>> Meta+D >>>> Deletes the text from the cursor to the end of the word >>>> Ctrl+W >>>> Deletes the text from the cursor to the previous white space >>>> Ctrl+Y >>>> Pastes the most recently deleted text into the line >>>> Meta+Y >>>> After Ctrl+Y, Meta+Y cycles through previously deleted text >>>> Ctrl+X then Ctrl+K >>>> Delete whole snippet >>>> >>>> >>>> --- Shortcuts for jshell tool --- >>>> >>>> For details, see: /help shortcuts >>>> >>>> Tab >>>> Complete Java identifier or jshell command >>>> Shift+Tab then v >>>> Convert expression to variable declaration >>>> Shift+Tab then m >>>> Convert statement to method declaration >>>> Shift+Tab then i >>>> Add imports for this identifier >>>> >>>> >>>> --- More line and history editing --- >>>> >>>> Ctrl+L >>>> Clear screen and reprint snippet >>>> Ctrl+U >>>> Kill whole line >>>> Ctrl+T >>>> Transpose characters >>>> Ctrl+X then Ctrl+B >>>> Navigate to matching bracket, parenthesis, ... >>>> Ctrl+X then = >>>> Enter show current character position mode >>>> Ctrl+X then Ctrl+O >>>> Toggle overwrite characters vs insert characters >>>> Meta+C >>>> Capitalize word >>>> Meta+U >>>> Convert word to uppercase >>>> Meta+L >>>> Convert word to lowercase >>>> Meta+0 through Meta+9 then key >>>> Repeat the specified number of times >>>> >>>> Where, for example, "Ctrl+A" means hold down the control key and >>>> press A. >>>> Where "Meta" is "Alt" on many keyboards. >>>> Line editing support is derived from JLine 3. >>>> >>>> _______________________________________________________________________________ >>>> >>>> >>>> >>>> >>>> >>>> -Robert >>>> >>>> >>>> >>>> On 12/8/18 11:47 AM, Jan Lahoda wrote: >>>>> On 8.12.2018 20:39, Robert Field wrote: >>>>>> Thanks for updating. >>>>>> >>>>>> Good to have /help for line editing keys, however: >>>>>> (1) The supported keys should be listed without requiring that >>>>>> the >>>>>> user knows or looks-up readline. More so, since only some readline >>>>>> keys >>>>>> are supposed. >>>>>> (2) "/edit" is a command, so with this change, typing "/help >>>>>> edit" >>>>>> would give both the /edit and editing help -- which would be >>>>>> confusing. >>>>>> I suggest "/help keys", there are no "k" help items. >>>>> >>>>> Will do. >>>>> >>>>>> (3) In jshell tool online docs the tool is spelled "jshell tool" >>>>>> I'd be happy to write up suggested text. >>>>> >>>>> Thanks, that would be very welcome! >>>>> >>>>>> >>>>>> As to the alternative patch: I understand the motivation, it >>>>>> would be >>>>>> nice to just use the natural "Enter" as new line. Unfortunately it's >>>>>> functionality is then overloaded. I believe the alternative will be >>>>>> confusing and awkward: >>>>>> (1) It breaks backward compatibility in user experience, Enter >>>>>> has >>>>>> always been accept/evaluate >>>>>> (2) It would be very awkward and non-intuitive (particularly in a >>>>>> long multiline snippet) to have to navigate to the end of the >>>>>> snippet to >>>>>> accept. >>>>>> Note: must be the end both vertically and horizontally. >>>>>> (3) It is inconsistent: Mid snippet Enter on one line does >>>>>> accept. >>>>>> However, on a continuation line (say after "int x =") it adds a new >>>>>> line >>>>>> instead. >>>>>> (4) It doesn't solve the problem for the most common location for >>>>>> adding a new line, the end of snippet -- thus introducing more >>>>>> inconsistency. >>>>> >>>>> Ok. This was meant more as a backup in case there's no reasonable >>>>> shortcut we could use to add new lines. >>>>> >>>>> Thanks for the comments! >>>>> >>>>> Jan >>>>> >>>>>> >>>>>> Thanks, >>>>>> Robert >>>>>> >>>>>> >>>>>> On 12/8/18 7:21 AM, Jan Lahoda wrote: >>>>>>> Hi, >>>>>>> >>>>>>> I've updated the patch to reflect the comments so far, the current >>>>>>> version is here: >>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01/ >>>>>>> Delta since the previous version is here for convenience: >>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01/ >>>>>>> >>>>>>> In this version, while editing a snippet, a new line can be added >>>>>>> using Alt-Enter (on platforms that support that), or Ctrl-Enter (on >>>>>>> Windows). >>>>>>> >>>>>>> >>>>>>> And alternative patch is here: >>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01a/ >>>>>>> Delta: >>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01a/ >>>>>>> >>>>>>> In the alternative version, Enter will only "confirm" multi-line >>>>>>> snippet when the cursor is at the end of the snippet, otherwise it >>>>>>> will add a new line (so that a special shortcut is not needed; >>>>>>> but a >>>>>>> snippet cannot be "confirmed" by pressing Enter in the middle of a >>>>>>> multi-line snippet.) >>>>>>> >>>>>>> The only difference between the .01 and .01a patches is the way >>>>>>> they >>>>>>> allow to add new lines into the multi-line snippets. Other changes >>>>>>> are >>>>>>> the same. >>>>>>> >>>>>>> Any feedback on this is welcome. >>>>>>> >>>>>>> Thanks! >>>>>>> >>>>>>> Jan >>>>>>> >>>>>>> On 5.12.2018 18:18, Jan Lahoda wrote: >>>>>>>> Hi Robert, >>>>>>>> >>>>>>>> On 4.12.2018 23:59, Robert Field wrote: >>>>>>>>> I saw no issues with JShell tool and test portions of the >>>>>>>>> webrev. I >>>>>>>>> did >>>>>>>>> not review the nashorn changes. >>>>>>>> >>>>>>>> Thanks for looking at this! >>>>>>>> >>>>>>>>> >>>>>>>>> Testing it: editing multi-line snippets is vastly easier and more >>>>>>>>> intuitive. >>>>>>>>> There is one issue, with the old mechanism, as horridly clunky >>>>>>>>> as it >>>>>>>>> was, you could add new lines of code (a frequently needed >>>>>>>>> functionality). >>>>>>>>> Since is accept, I could find no way to add lines with >>>>>>>>> this >>>>>>>>> JLine 3 version. Thoughts? >>>>>>>> >>>>>>>> One possibility that comes to mind: pressing Enter inside the >>>>>>>> snippet >>>>>>>> would add a new line, Enter at the very end of a (complete) >>>>>>>> snippet >>>>>>>> would confirm that snippet. Could be fairly convenient/intuitive. >>>>>>>> What >>>>>>>> do you think? >>>>>>>> >>>>>>>>> >>>>>>>>> I looked into readline commands as an approach to addressing >>>>>>>>> this, >>>>>>>>> found >>>>>>>>> nothing. However, most readline commands worked. Ctrl-u however >>>>>>>>> did >>>>>>>>> not >>>>>>>>> behave as documented in readline (instead deleting to the >>>>>>>>> beginning of >>>>>>>>> the line). I notice that the there is zero in-command >>>>>>>>> documentation of >>>>>>>>> command-line editing -- not even a mention. Independent from the >>>>>>>>> review >>>>>>>>> of this port, it seems we should have in-command documentation of >>>>>>>>> command editing -- even more so now that multiline editing is >>>>>>>>> useful. >>>>>>>> >>>>>>>> This is about enhancing /help, right? I'll see what I can do. >>>>>>>> >>>>>>>>> >>>>>>>>> The JShell User Manual will also need a little edit in the >>>>>>>>> History >>>>>>>>> Navigation section. >>>>>>>> >>>>>>>> Where is that? >>>>>>>> >>>>>>>> Thanks, >>>>>>>> Jan >>>>>>>> >>>>>>>>> >>>>>>>>> -Robert >>>>>>>>> >>>>>>>>> >>>>>>>>> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>>>>>>>>> Hi, >>>>>>>>>> >>>>>>>>>> I'd like to update the internal JLine used by JShell and jjs to >>>>>>>>>> JLine >>>>>>>>>> 3.9.0. Two notable advantages of this version is multi-line >>>>>>>>>> snippet >>>>>>>>>> editing and better UI on Windows (escape sequence support on >>>>>>>>>> Windows). >>>>>>>>>> As a consequence, this patch drops EditingHistory, as it does >>>>>>>>>> not >>>>>>>>>> seem >>>>>>>>>> to be needed anymore. >>>>>>>>>> >>>>>>>>>> JBS: >>>>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>>>>>>>>> >>>>>>>>>> The full patch is here: >>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> To make the changes more clear, I've split it into two: >>>>>>>>>> -replacement of existing JLine with the new on in >>>>>>>>>> jdk.internal.le, no >>>>>>>>>> changes to JLine code: >>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>>>>>>>>> >>>>>>>>>> -tweaks to JLine (repackaging, eliminating references to >>>>>>>>>> j.u.l.Logger, >>>>>>>>>> adding hooks to wrap input streams with our stop-detecting input >>>>>>>>>> stream, adding unicode escapes to unicode characters, support >>>>>>>>>> for >>>>>>>>>> Windows without JNA), adjustments to JShell and jjs >>>>>>>>>> (unfortunately, >>>>>>>>>> 3.9.0 is not compatible with the JLine 2 branch, so the changes >>>>>>>>>> are >>>>>>>>>> substantial): >>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>>>>>>>>> >>>>>>>>>> Any feedback is welcome! >>>>>>>>>> >>>>>>>>>> Thanks, >>>>>>>>>> Jan >> >> >> From jan.lahoda at oracle.com Mon Dec 10 09:39:08 2018 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Mon, 10 Dec 2018 10:39:08 +0100 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <5C0DF79F.7050500@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> <5C0BE192.8010404@oracle.com> <1fd7c4d3-b446-f695-025e-3ef3c0980744@oracle.com> <5C0C1FBA.2050602@oracle.com> <6eef7f37-897c-7f02-f430-13400cdbc80a@oracle.com> <5C0D2866.6020105@oracle.com> <16793a02408.2794.4011f3a8741ca2aabce58b8b81f42d24@oracle.com> <5C0D9B1A.3080409@oracle.com> <5C0DF79F.7050500@oracle.com> Message-ID: <5C0E343C.8000705@oracle.com> Hi Sundar, Thanks for finding the problem! I was running tier1-3 tests, but seems these are not there. Seems the problem is how JLine(3) handles "dumb" terminals, it probably does not affect interactive use. So, adjusting the expected output should hopefully be OK. Updated patch: http://cr.openjdk.java.net/~jlahoda/8214491/webrev.04/index.html Delta from previous: http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.03.04/ How does this look? Thanks! Jan On 10.12.2018 06:20, Sundararajan Athijegannathan wrote: > I built jdk and ran nashorn tests with this patch. Two tests fail with > this patch - but those tests pass without this patch: > > [testng] Test test/nashorn/script/nosecurity/JDK-8055034.js failed > at line 1 - > [testng] expected: 'jjs> var x = Object.create(null);' > [testng] found: 'jjs> var x = Object.create(null)jjs> jjs> > print('PASSED')PASSED' > > [testng] Test test/nashorn/script/nosecurity/JDK-8130127.js failed > at line 5 - > [testng] expected: 'jjs> print('hello')' > [testng] found: 'jjs> print('hello')hello' > > Both tests involving exec'ing jjs and comparing with the expected > output. Either we need to add these to failing tests and/or address the > issue before push. > > Thanks, > -Sundar > > On 10/12/18, 4:15 AM, Jan Lahoda wrote: >> On 9.12.2018 16:40, Robert Field wrote: >>> Ok. Go ahead and incorporate the text. I'll make a separate bug to sync >>> the representation of keys in the other help entries. >> >> An updated patch (with your text): >> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.03/ >> Delta from previous patch: >> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.02.03/ >> >> Thanks for the comments and for the text! Any feedback is welcome. >> >> Thanks, >> Jan >> >> >>> >>> Robert >>> >>> >>> On December 9, 2018 6:36:26 AM Jan Lahoda wrote: >>> >>>> Hi Robert, >>>> >>>> On 9.12.2018 02:40, Robert Field wrote: >>>>> OK, here is my thinking on a /help keys entry. Note: I'm using the >>>> >>>> I think this looks great! >>>> >>>>> representation for keys used by the User's Guide -- which I assume is >>>>> the official tech pubs style -- seems we should be consistent; If >>>>> we are >>>>> however, the other /help entries should be brought into compliance >>>>> (they >>>>> seem to be all over the map already). May make sense to spin this off >>>>> as a separate bug, which I'd be happy to take on. >>>> >>>> I'm happy with a separate bug, if you prefer/are OK with that. Or I can >>>> incorporate the text into upgrade patch, whichever you prefer. >>>> >>>> I've updated my current patch with only a rename "editing" -> "keys" >>>> and >>>> the fix to the jshell tool name: >>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.02/ >>>> >>>> Delta from last: >>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.01.02/ >>>> >>>> Jan >>>> >>>>> >>>>> Comments welcome --- >>>>> >>>>> __________________________________________________________________________________________________________________________ >>>>> >>>>> >>>>> >>>>> >>>>> /help keys >>>>> ========== >>>>> >>>>> The jshell tool provides line editing support to allow you to navigate >>>>> within and edit snippets and commands. The current command/snippet can >>>>> be edited, or prior commands/snippets can be retrieved from history, >>>>> edited, and executed. This support is similar to readline/editline >>>>> with >>>>> simple emacs-like bindings. There are also jshell tool specific key >>>>> sequences. >>>>> >>>>> --- Line and history navigation --- >>>>> >>>>> Return >>>>> Enters the current snippet >>>>> Left-arrow or Ctrl+B >>>>> Moves backward one character >>>>> Right-arrow or Ctrl+F >>>>> Moves forward one character >>>>> Up-arrow or Ctrl+P >>>>> Moves up one line, backward through history >>>>> Down arrow or Ctrl+N >>>>> Moves down one line, forward through history >>>>> Ctrl+A >>>>> Moves to the beginning of the line >>>>> Ctrl+E >>>>> Moves to the end of the line >>>>> Meta+B >>>>> Moves backward one word >>>>> Meta+F >>>>> Moves forward one word >>>>> Ctrl+R >>>>> Search backward through history >>>>> >>>>> >>>>> --- Line and history basic editing --- >>>>> >>>>> Meta+Return or Ctrl+Return (depending on platform) >>>>> Insert a new line in snippet >>>>> Ctrl+_ (underscore may require shift key) or Ctrl-X then Ctrl-U >>>>> Undo edit - repeat to undo more edits >>>>> Delete >>>>> Deletes the character at or after the cursor, depending on the >>>>> operating system >>>>> Backspace >>>>> Deletes the character before the cursor >>>>> Ctrl+K >>>>> Deletes the text from the cursor to the end of the line >>>>> Meta+D >>>>> Deletes the text from the cursor to the end of the word >>>>> Ctrl+W >>>>> Deletes the text from the cursor to the previous white space >>>>> Ctrl+Y >>>>> Pastes the most recently deleted text into the line >>>>> Meta+Y >>>>> After Ctrl+Y, Meta+Y cycles through previously deleted text >>>>> Ctrl+X then Ctrl+K >>>>> Delete whole snippet >>>>> >>>>> >>>>> --- Shortcuts for jshell tool --- >>>>> >>>>> For details, see: /help shortcuts >>>>> >>>>> Tab >>>>> Complete Java identifier or jshell command >>>>> Shift+Tab then v >>>>> Convert expression to variable declaration >>>>> Shift+Tab then m >>>>> Convert statement to method declaration >>>>> Shift+Tab then i >>>>> Add imports for this identifier >>>>> >>>>> >>>>> --- More line and history editing --- >>>>> >>>>> Ctrl+L >>>>> Clear screen and reprint snippet >>>>> Ctrl+U >>>>> Kill whole line >>>>> Ctrl+T >>>>> Transpose characters >>>>> Ctrl+X then Ctrl+B >>>>> Navigate to matching bracket, parenthesis, ... >>>>> Ctrl+X then = >>>>> Enter show current character position mode >>>>> Ctrl+X then Ctrl+O >>>>> Toggle overwrite characters vs insert characters >>>>> Meta+C >>>>> Capitalize word >>>>> Meta+U >>>>> Convert word to uppercase >>>>> Meta+L >>>>> Convert word to lowercase >>>>> Meta+0 through Meta+9 then key >>>>> Repeat the specified number of times >>>>> >>>>> Where, for example, "Ctrl+A" means hold down the control key and >>>>> press A. >>>>> Where "Meta" is "Alt" on many keyboards. >>>>> Line editing support is derived from JLine 3. >>>>> >>>>> _______________________________________________________________________________ >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> -Robert >>>>> >>>>> >>>>> >>>>> On 12/8/18 11:47 AM, Jan Lahoda wrote: >>>>>> On 8.12.2018 20:39, Robert Field wrote: >>>>>>> Thanks for updating. >>>>>>> >>>>>>> Good to have /help for line editing keys, however: >>>>>>> (1) The supported keys should be listed without requiring that >>>>>>> the >>>>>>> user knows or looks-up readline. More so, since only some readline >>>>>>> keys >>>>>>> are supposed. >>>>>>> (2) "/edit" is a command, so with this change, typing "/help >>>>>>> edit" >>>>>>> would give both the /edit and editing help -- which would be >>>>>>> confusing. >>>>>>> I suggest "/help keys", there are no "k" help items. >>>>>> >>>>>> Will do. >>>>>> >>>>>>> (3) In jshell tool online docs the tool is spelled "jshell tool" >>>>>>> I'd be happy to write up suggested text. >>>>>> >>>>>> Thanks, that would be very welcome! >>>>>> >>>>>>> >>>>>>> As to the alternative patch: I understand the motivation, it >>>>>>> would be >>>>>>> nice to just use the natural "Enter" as new line. Unfortunately it's >>>>>>> functionality is then overloaded. I believe the alternative will be >>>>>>> confusing and awkward: >>>>>>> (1) It breaks backward compatibility in user experience, Enter >>>>>>> has >>>>>>> always been accept/evaluate >>>>>>> (2) It would be very awkward and non-intuitive (particularly in a >>>>>>> long multiline snippet) to have to navigate to the end of the >>>>>>> snippet to >>>>>>> accept. >>>>>>> Note: must be the end both vertically and horizontally. >>>>>>> (3) It is inconsistent: Mid snippet Enter on one line does >>>>>>> accept. >>>>>>> However, on a continuation line (say after "int x =") it adds a new >>>>>>> line >>>>>>> instead. >>>>>>> (4) It doesn't solve the problem for the most common location for >>>>>>> adding a new line, the end of snippet -- thus introducing more >>>>>>> inconsistency. >>>>>> >>>>>> Ok. This was meant more as a backup in case there's no reasonable >>>>>> shortcut we could use to add new lines. >>>>>> >>>>>> Thanks for the comments! >>>>>> >>>>>> Jan >>>>>> >>>>>>> >>>>>>> Thanks, >>>>>>> Robert >>>>>>> >>>>>>> >>>>>>> On 12/8/18 7:21 AM, Jan Lahoda wrote: >>>>>>>> Hi, >>>>>>>> >>>>>>>> I've updated the patch to reflect the comments so far, the current >>>>>>>> version is here: >>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01/ >>>>>>>> Delta since the previous version is here for convenience: >>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01/ >>>>>>>> >>>>>>>> In this version, while editing a snippet, a new line can be added >>>>>>>> using Alt-Enter (on platforms that support that), or Ctrl-Enter (on >>>>>>>> Windows). >>>>>>>> >>>>>>>> >>>>>>>> And alternative patch is here: >>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01a/ >>>>>>>> Delta: >>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01a/ >>>>>>>> >>>>>>>> In the alternative version, Enter will only "confirm" multi-line >>>>>>>> snippet when the cursor is at the end of the snippet, otherwise it >>>>>>>> will add a new line (so that a special shortcut is not needed; >>>>>>>> but a >>>>>>>> snippet cannot be "confirmed" by pressing Enter in the middle of a >>>>>>>> multi-line snippet.) >>>>>>>> >>>>>>>> The only difference between the .01 and .01a patches is the way >>>>>>>> they >>>>>>>> allow to add new lines into the multi-line snippets. Other changes >>>>>>>> are >>>>>>>> the same. >>>>>>>> >>>>>>>> Any feedback on this is welcome. >>>>>>>> >>>>>>>> Thanks! >>>>>>>> >>>>>>>> Jan >>>>>>>> >>>>>>>> On 5.12.2018 18:18, Jan Lahoda wrote: >>>>>>>>> Hi Robert, >>>>>>>>> >>>>>>>>> On 4.12.2018 23:59, Robert Field wrote: >>>>>>>>>> I saw no issues with JShell tool and test portions of the >>>>>>>>>> webrev. I >>>>>>>>>> did >>>>>>>>>> not review the nashorn changes. >>>>>>>>> >>>>>>>>> Thanks for looking at this! >>>>>>>>> >>>>>>>>>> >>>>>>>>>> Testing it: editing multi-line snippets is vastly easier and more >>>>>>>>>> intuitive. >>>>>>>>>> There is one issue, with the old mechanism, as horridly clunky >>>>>>>>>> as it >>>>>>>>>> was, you could add new lines of code (a frequently needed >>>>>>>>>> functionality). >>>>>>>>>> Since is accept, I could find no way to add lines with >>>>>>>>>> this >>>>>>>>>> JLine 3 version. Thoughts? >>>>>>>>> >>>>>>>>> One possibility that comes to mind: pressing Enter inside the >>>>>>>>> snippet >>>>>>>>> would add a new line, Enter at the very end of a (complete) >>>>>>>>> snippet >>>>>>>>> would confirm that snippet. Could be fairly convenient/intuitive. >>>>>>>>> What >>>>>>>>> do you think? >>>>>>>>> >>>>>>>>>> >>>>>>>>>> I looked into readline commands as an approach to addressing >>>>>>>>>> this, >>>>>>>>>> found >>>>>>>>>> nothing. However, most readline commands worked. Ctrl-u however >>>>>>>>>> did >>>>>>>>>> not >>>>>>>>>> behave as documented in readline (instead deleting to the >>>>>>>>>> beginning of >>>>>>>>>> the line). I notice that the there is zero in-command >>>>>>>>>> documentation of >>>>>>>>>> command-line editing -- not even a mention. Independent from the >>>>>>>>>> review >>>>>>>>>> of this port, it seems we should have in-command documentation of >>>>>>>>>> command editing -- even more so now that multiline editing is >>>>>>>>>> useful. >>>>>>>>> >>>>>>>>> This is about enhancing /help, right? I'll see what I can do. >>>>>>>>> >>>>>>>>>> >>>>>>>>>> The JShell User Manual will also need a little edit in the >>>>>>>>>> History >>>>>>>>>> Navigation section. >>>>>>>>> >>>>>>>>> Where is that? >>>>>>>>> >>>>>>>>> Thanks, >>>>>>>>> Jan >>>>>>>>> >>>>>>>>>> >>>>>>>>>> -Robert >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>>>>>>>>>> Hi, >>>>>>>>>>> >>>>>>>>>>> I'd like to update the internal JLine used by JShell and jjs to >>>>>>>>>>> JLine >>>>>>>>>>> 3.9.0. Two notable advantages of this version is multi-line >>>>>>>>>>> snippet >>>>>>>>>>> editing and better UI on Windows (escape sequence support on >>>>>>>>>>> Windows). >>>>>>>>>>> As a consequence, this patch drops EditingHistory, as it does >>>>>>>>>>> not >>>>>>>>>>> seem >>>>>>>>>>> to be needed anymore. >>>>>>>>>>> >>>>>>>>>>> JBS: >>>>>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>>>>>>>>>> >>>>>>>>>>> The full patch is here: >>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> To make the changes more clear, I've split it into two: >>>>>>>>>>> -replacement of existing JLine with the new on in >>>>>>>>>>> jdk.internal.le, no >>>>>>>>>>> changes to JLine code: >>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>>>>>>>>>> >>>>>>>>>>> -tweaks to JLine (repackaging, eliminating references to >>>>>>>>>>> j.u.l.Logger, >>>>>>>>>>> adding hooks to wrap input streams with our stop-detecting input >>>>>>>>>>> stream, adding unicode escapes to unicode characters, support >>>>>>>>>>> for >>>>>>>>>>> Windows without JNA), adjustments to JShell and jjs >>>>>>>>>>> (unfortunately, >>>>>>>>>>> 3.9.0 is not compatible with the JLine 2 branch, so the changes >>>>>>>>>>> are >>>>>>>>>>> substantial): >>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>>>>>>>>>> >>>>>>>>>>> Any feedback is welcome! >>>>>>>>>>> >>>>>>>>>>> Thanks, >>>>>>>>>>> Jan >>> >>> >>> From sundararajan.athijegannathan at oracle.com Mon Dec 10 10:14:35 2018 From: sundararajan.athijegannathan at oracle.com (Sundararajan Athijegannathan) Date: Mon, 10 Dec 2018 15:44:35 +0530 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <5C0E343C.8000705@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> <5C0BE192.8010404@oracle.com> <1fd7c4d3-b446-f695-025e-3ef3c0980744@oracle.com> <5C0C1FBA.2050602@oracle.com> <6eef7f37-897c-7f02-f430-13400cdbc80a@oracle.com> <5C0D2866.6020105@oracle.com> <16793a02408.2794.4011f3a8741ca2aabce58b8b81f42d24@oracle.com> <5C0D9B1A.3080409@oracle.com> <5C0DF79F.7050500@oracle.com> <5C0E343C.8000705@oracle.com> Message-ID: <5C0E3C8B.2040903@oracle.com> Hi Jan, Tests are fine. Because there are not many UI automated tests for jjs, I tried to manually test few features. Tab-completion seems to be messed up. Only top-level completion seems to work. Property/method completion and inside multi-line method etc. don't seem to work. Thanks, -Sundar On 10/12/18, 3:09 PM, Jan Lahoda wrote: > Hi Sundar, > > Thanks for finding the problem! I was running tier1-3 tests, but seems > these are not there. > > Seems the problem is how JLine(3) handles "dumb" terminals, it > probably does not affect interactive use. So, adjusting the expected > output should hopefully be OK. > > Updated patch: > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.04/index.html > Delta from previous: > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.03.04/ > > How does this look? > > Thanks! > > Jan > > On 10.12.2018 06:20, Sundararajan Athijegannathan wrote: >> I built jdk and ran nashorn tests with this patch. Two tests fail with >> this patch - but those tests pass without this patch: >> >> [testng] Test test/nashorn/script/nosecurity/JDK-8055034.js failed >> at line 1 - >> [testng] expected: 'jjs> var x = Object.create(null);' >> [testng] found: 'jjs> var x = Object.create(null)jjs> jjs> >> print('PASSED')PASSED' >> >> [testng] Test test/nashorn/script/nosecurity/JDK-8130127.js failed >> at line 5 - >> [testng] expected: 'jjs> print('hello')' >> [testng] found: 'jjs> print('hello')hello' >> >> Both tests involving exec'ing jjs and comparing with the expected >> output. Either we need to add these to failing tests and/or address the >> issue before push. >> >> Thanks, >> -Sundar >> >> On 10/12/18, 4:15 AM, Jan Lahoda wrote: >>> On 9.12.2018 16:40, Robert Field wrote: >>>> Ok. Go ahead and incorporate the text. I'll make a separate bug to >>>> sync >>>> the representation of keys in the other help entries. >>> >>> An updated patch (with your text): >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.03/ >>> Delta from previous patch: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.02.03/ >>> >>> Thanks for the comments and for the text! Any feedback is welcome. >>> >>> Thanks, >>> Jan >>> >>> >>>> >>>> Robert >>>> >>>> >>>> On December 9, 2018 6:36:26 AM Jan Lahoda >>>> wrote: >>>> >>>>> Hi Robert, >>>>> >>>>> On 9.12.2018 02:40, Robert Field wrote: >>>>>> OK, here is my thinking on a /help keys entry. Note: I'm using the >>>>> >>>>> I think this looks great! >>>>> >>>>>> representation for keys used by the User's Guide -- which I >>>>>> assume is >>>>>> the official tech pubs style -- seems we should be consistent; If >>>>>> we are >>>>>> however, the other /help entries should be brought into compliance >>>>>> (they >>>>>> seem to be all over the map already). May make sense to spin >>>>>> this off >>>>>> as a separate bug, which I'd be happy to take on. >>>>> >>>>> I'm happy with a separate bug, if you prefer/are OK with that. Or >>>>> I can >>>>> incorporate the text into upgrade patch, whichever you prefer. >>>>> >>>>> I've updated my current patch with only a rename "editing" -> "keys" >>>>> and >>>>> the fix to the jshell tool name: >>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.02/ >>>>> >>>>> Delta from last: >>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.01.02/ >>>>> >>>>> Jan >>>>> >>>>>> >>>>>> Comments welcome --- >>>>>> >>>>>> __________________________________________________________________________________________________________________________ >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> /help keys >>>>>> ========== >>>>>> >>>>>> The jshell tool provides line editing support to allow you to >>>>>> navigate >>>>>> within and edit snippets and commands. The current >>>>>> command/snippet can >>>>>> be edited, or prior commands/snippets can be retrieved from history, >>>>>> edited, and executed. This support is similar to readline/editline >>>>>> with >>>>>> simple emacs-like bindings. There are also jshell tool specific key >>>>>> sequences. >>>>>> >>>>>> --- Line and history navigation --- >>>>>> >>>>>> Return >>>>>> Enters the current snippet >>>>>> Left-arrow or Ctrl+B >>>>>> Moves backward one character >>>>>> Right-arrow or Ctrl+F >>>>>> Moves forward one character >>>>>> Up-arrow or Ctrl+P >>>>>> Moves up one line, backward through history >>>>>> Down arrow or Ctrl+N >>>>>> Moves down one line, forward through history >>>>>> Ctrl+A >>>>>> Moves to the beginning of the line >>>>>> Ctrl+E >>>>>> Moves to the end of the line >>>>>> Meta+B >>>>>> Moves backward one word >>>>>> Meta+F >>>>>> Moves forward one word >>>>>> Ctrl+R >>>>>> Search backward through history >>>>>> >>>>>> >>>>>> --- Line and history basic editing --- >>>>>> >>>>>> Meta+Return or Ctrl+Return (depending on platform) >>>>>> Insert a new line in snippet >>>>>> Ctrl+_ (underscore may require shift key) or Ctrl-X then Ctrl-U >>>>>> Undo edit - repeat to undo more edits >>>>>> Delete >>>>>> Deletes the character at or after the cursor, depending on the >>>>>> operating system >>>>>> Backspace >>>>>> Deletes the character before the cursor >>>>>> Ctrl+K >>>>>> Deletes the text from the cursor to the end of the line >>>>>> Meta+D >>>>>> Deletes the text from the cursor to the end of the word >>>>>> Ctrl+W >>>>>> Deletes the text from the cursor to the previous white space >>>>>> Ctrl+Y >>>>>> Pastes the most recently deleted text into the line >>>>>> Meta+Y >>>>>> After Ctrl+Y, Meta+Y cycles through previously deleted text >>>>>> Ctrl+X then Ctrl+K >>>>>> Delete whole snippet >>>>>> >>>>>> >>>>>> --- Shortcuts for jshell tool --- >>>>>> >>>>>> For details, see: /help shortcuts >>>>>> >>>>>> Tab >>>>>> Complete Java identifier or jshell command >>>>>> Shift+Tab then v >>>>>> Convert expression to variable declaration >>>>>> Shift+Tab then m >>>>>> Convert statement to method declaration >>>>>> Shift+Tab then i >>>>>> Add imports for this identifier >>>>>> >>>>>> >>>>>> --- More line and history editing --- >>>>>> >>>>>> Ctrl+L >>>>>> Clear screen and reprint snippet >>>>>> Ctrl+U >>>>>> Kill whole line >>>>>> Ctrl+T >>>>>> Transpose characters >>>>>> Ctrl+X then Ctrl+B >>>>>> Navigate to matching bracket, parenthesis, ... >>>>>> Ctrl+X then = >>>>>> Enter show current character position mode >>>>>> Ctrl+X then Ctrl+O >>>>>> Toggle overwrite characters vs insert characters >>>>>> Meta+C >>>>>> Capitalize word >>>>>> Meta+U >>>>>> Convert word to uppercase >>>>>> Meta+L >>>>>> Convert word to lowercase >>>>>> Meta+0 through Meta+9 then key >>>>>> Repeat the specified number of times >>>>>> >>>>>> Where, for example, "Ctrl+A" means hold down the control key and >>>>>> press A. >>>>>> Where "Meta" is "Alt" on many keyboards. >>>>>> Line editing support is derived from JLine 3. >>>>>> >>>>>> _______________________________________________________________________________ >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -Robert >>>>>> >>>>>> >>>>>> >>>>>> On 12/8/18 11:47 AM, Jan Lahoda wrote: >>>>>>> On 8.12.2018 20:39, Robert Field wrote: >>>>>>>> Thanks for updating. >>>>>>>> >>>>>>>> Good to have /help for line editing keys, however: >>>>>>>> (1) The supported keys should be listed without requiring that >>>>>>>> the >>>>>>>> user knows or looks-up readline. More so, since only some readline >>>>>>>> keys >>>>>>>> are supposed. >>>>>>>> (2) "/edit" is a command, so with this change, typing "/help >>>>>>>> edit" >>>>>>>> would give both the /edit and editing help -- which would be >>>>>>>> confusing. >>>>>>>> I suggest "/help keys", there are no "k" help items. >>>>>>> >>>>>>> Will do. >>>>>>> >>>>>>>> (3) In jshell tool online docs the tool is spelled "jshell >>>>>>>> tool" >>>>>>>> I'd be happy to write up suggested text. >>>>>>> >>>>>>> Thanks, that would be very welcome! >>>>>>> >>>>>>>> >>>>>>>> As to the alternative patch: I understand the motivation, it >>>>>>>> would be >>>>>>>> nice to just use the natural "Enter" as new line. Unfortunately >>>>>>>> it's >>>>>>>> functionality is then overloaded. I believe the alternative >>>>>>>> will be >>>>>>>> confusing and awkward: >>>>>>>> (1) It breaks backward compatibility in user experience, Enter >>>>>>>> has >>>>>>>> always been accept/evaluate >>>>>>>> (2) It would be very awkward and non-intuitive (particularly >>>>>>>> in a >>>>>>>> long multiline snippet) to have to navigate to the end of the >>>>>>>> snippet to >>>>>>>> accept. >>>>>>>> Note: must be the end both vertically and horizontally. >>>>>>>> (3) It is inconsistent: Mid snippet Enter on one line does >>>>>>>> accept. >>>>>>>> However, on a continuation line (say after "int x =") it adds a >>>>>>>> new >>>>>>>> line >>>>>>>> instead. >>>>>>>> (4) It doesn't solve the problem for the most common >>>>>>>> location for >>>>>>>> adding a new line, the end of snippet -- thus introducing more >>>>>>>> inconsistency. >>>>>>> >>>>>>> Ok. This was meant more as a backup in case there's no reasonable >>>>>>> shortcut we could use to add new lines. >>>>>>> >>>>>>> Thanks for the comments! >>>>>>> >>>>>>> Jan >>>>>>> >>>>>>>> >>>>>>>> Thanks, >>>>>>>> Robert >>>>>>>> >>>>>>>> >>>>>>>> On 12/8/18 7:21 AM, Jan Lahoda wrote: >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> I've updated the patch to reflect the comments so far, the >>>>>>>>> current >>>>>>>>> version is here: >>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01/ >>>>>>>>> Delta since the previous version is here for convenience: >>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01/ >>>>>>>>> >>>>>>>>> In this version, while editing a snippet, a new line can be added >>>>>>>>> using Alt-Enter (on platforms that support that), or >>>>>>>>> Ctrl-Enter (on >>>>>>>>> Windows). >>>>>>>>> >>>>>>>>> >>>>>>>>> And alternative patch is here: >>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01a/ >>>>>>>>> Delta: >>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01a/ >>>>>>>>> >>>>>>>>> In the alternative version, Enter will only "confirm" multi-line >>>>>>>>> snippet when the cursor is at the end of the snippet, >>>>>>>>> otherwise it >>>>>>>>> will add a new line (so that a special shortcut is not needed; >>>>>>>>> but a >>>>>>>>> snippet cannot be "confirmed" by pressing Enter in the middle >>>>>>>>> of a >>>>>>>>> multi-line snippet.) >>>>>>>>> >>>>>>>>> The only difference between the .01 and .01a patches is the way >>>>>>>>> they >>>>>>>>> allow to add new lines into the multi-line snippets. Other >>>>>>>>> changes >>>>>>>>> are >>>>>>>>> the same. >>>>>>>>> >>>>>>>>> Any feedback on this is welcome. >>>>>>>>> >>>>>>>>> Thanks! >>>>>>>>> >>>>>>>>> Jan >>>>>>>>> >>>>>>>>> On 5.12.2018 18:18, Jan Lahoda wrote: >>>>>>>>>> Hi Robert, >>>>>>>>>> >>>>>>>>>> On 4.12.2018 23:59, Robert Field wrote: >>>>>>>>>>> I saw no issues with JShell tool and test portions of the >>>>>>>>>>> webrev. I >>>>>>>>>>> did >>>>>>>>>>> not review the nashorn changes. >>>>>>>>>> >>>>>>>>>> Thanks for looking at this! >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Testing it: editing multi-line snippets is vastly easier and >>>>>>>>>>> more >>>>>>>>>>> intuitive. >>>>>>>>>>> There is one issue, with the old mechanism, as horridly clunky >>>>>>>>>>> as it >>>>>>>>>>> was, you could add new lines of code (a frequently needed >>>>>>>>>>> functionality). >>>>>>>>>>> Since is accept, I could find no way to add lines with >>>>>>>>>>> this >>>>>>>>>>> JLine 3 version. Thoughts? >>>>>>>>>> >>>>>>>>>> One possibility that comes to mind: pressing Enter inside the >>>>>>>>>> snippet >>>>>>>>>> would add a new line, Enter at the very end of a (complete) >>>>>>>>>> snippet >>>>>>>>>> would confirm that snippet. Could be fairly >>>>>>>>>> convenient/intuitive. >>>>>>>>>> What >>>>>>>>>> do you think? >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> I looked into readline commands as an approach to addressing >>>>>>>>>>> this, >>>>>>>>>>> found >>>>>>>>>>> nothing. However, most readline commands worked. Ctrl-u >>>>>>>>>>> however >>>>>>>>>>> did >>>>>>>>>>> not >>>>>>>>>>> behave as documented in readline (instead deleting to the >>>>>>>>>>> beginning of >>>>>>>>>>> the line). I notice that the there is zero in-command >>>>>>>>>>> documentation of >>>>>>>>>>> command-line editing -- not even a mention. Independent >>>>>>>>>>> from the >>>>>>>>>>> review >>>>>>>>>>> of this port, it seems we should have in-command >>>>>>>>>>> documentation of >>>>>>>>>>> command editing -- even more so now that multiline editing is >>>>>>>>>>> useful. >>>>>>>>>> >>>>>>>>>> This is about enhancing /help, right? I'll see what I can do. >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> The JShell User Manual will also need a little edit in the >>>>>>>>>>> History >>>>>>>>>>> Navigation section. >>>>>>>>>> >>>>>>>>>> Where is that? >>>>>>>>>> >>>>>>>>>> Thanks, >>>>>>>>>> Jan >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> -Robert >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>>>>>>>>>>> Hi, >>>>>>>>>>>> >>>>>>>>>>>> I'd like to update the internal JLine used by JShell and >>>>>>>>>>>> jjs to >>>>>>>>>>>> JLine >>>>>>>>>>>> 3.9.0. Two notable advantages of this version is multi-line >>>>>>>>>>>> snippet >>>>>>>>>>>> editing and better UI on Windows (escape sequence support on >>>>>>>>>>>> Windows). >>>>>>>>>>>> As a consequence, this patch drops EditingHistory, as it does >>>>>>>>>>>> not >>>>>>>>>>>> seem >>>>>>>>>>>> to be needed anymore. >>>>>>>>>>>> >>>>>>>>>>>> JBS: >>>>>>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>>>>>>>>>>> >>>>>>>>>>>> The full patch is here: >>>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> To make the changes more clear, I've split it into two: >>>>>>>>>>>> -replacement of existing JLine with the new on in >>>>>>>>>>>> jdk.internal.le, no >>>>>>>>>>>> changes to JLine code: >>>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>>>>>>>>>>> >>>>>>>>>>>> -tweaks to JLine (repackaging, eliminating references to >>>>>>>>>>>> j.u.l.Logger, >>>>>>>>>>>> adding hooks to wrap input streams with our stop-detecting >>>>>>>>>>>> input >>>>>>>>>>>> stream, adding unicode escapes to unicode characters, support >>>>>>>>>>>> for >>>>>>>>>>>> Windows without JNA), adjustments to JShell and jjs >>>>>>>>>>>> (unfortunately, >>>>>>>>>>>> 3.9.0 is not compatible with the JLine 2 branch, so the >>>>>>>>>>>> changes >>>>>>>>>>>> are >>>>>>>>>>>> substantial): >>>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>>>>>>>>>>> >>>>>>>>>>>> Any feedback is welcome! >>>>>>>>>>>> >>>>>>>>>>>> Thanks, >>>>>>>>>>>> Jan >>>> >>>> >>>> From jan.lahoda at oracle.com Mon Dec 10 13:03:51 2018 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Mon, 10 Dec 2018 14:03:51 +0100 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <5C0E3C8B.2040903@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> <5C0BE192.8010404@oracle.com> <1fd7c4d3-b446-f695-025e-3ef3c0980744@oracle.com> <5C0C1FBA.2050602@oracle.com> <6eef7f37-897c-7f02-f430-13400cdbc80a@oracle.com> <5C0D2866.6020105@oracle.com> <16793a02408.2794.4011f3a8741ca2aabce58b8b81f42d24@oracle.com> <5C0D9B1A.3080409@oracle.com> <5C0DF79F.7050500@oracle.com> <5C0E343C.8000705@oracle.com> <5C0E3C8B.2040903@oracle.com> Message-ID: <5C0E6437.8000307@oracle.com> Thanks for testing Sundar! I've tried to update the jjs completion handling to fix this problem here: http://cr.openjdk.java.net/~jlahoda/8214491/webrev.05/ Delta from previous patch: http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.04.05/ What do you think? Thanks, Jan On 10.12.2018 11:14, Sundararajan Athijegannathan wrote: > Hi Jan, > > Tests are fine. Because there are not many UI automated tests for jjs, I > tried to manually test few features. > > Tab-completion seems to be messed up. Only top-level completion seems to > work. Property/method completion and inside multi-line method etc. don't > seem to work. > > Thanks, > -Sundar > > > On 10/12/18, 3:09 PM, Jan Lahoda wrote: >> Hi Sundar, >> >> Thanks for finding the problem! I was running tier1-3 tests, but seems >> these are not there. >> >> Seems the problem is how JLine(3) handles "dumb" terminals, it >> probably does not affect interactive use. So, adjusting the expected >> output should hopefully be OK. >> >> Updated patch: >> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.04/index.html >> Delta from previous: >> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.03.04/ >> >> How does this look? >> >> Thanks! >> >> Jan >> >> On 10.12.2018 06:20, Sundararajan Athijegannathan wrote: >>> I built jdk and ran nashorn tests with this patch. Two tests fail with >>> this patch - but those tests pass without this patch: >>> >>> [testng] Test test/nashorn/script/nosecurity/JDK-8055034.js failed >>> at line 1 - >>> [testng] expected: 'jjs> var x = Object.create(null);' >>> [testng] found: 'jjs> var x = Object.create(null)jjs> jjs> >>> print('PASSED')PASSED' >>> >>> [testng] Test test/nashorn/script/nosecurity/JDK-8130127.js failed >>> at line 5 - >>> [testng] expected: 'jjs> print('hello')' >>> [testng] found: 'jjs> print('hello')hello' >>> >>> Both tests involving exec'ing jjs and comparing with the expected >>> output. Either we need to add these to failing tests and/or address the >>> issue before push. >>> >>> Thanks, >>> -Sundar >>> >>> On 10/12/18, 4:15 AM, Jan Lahoda wrote: >>>> On 9.12.2018 16:40, Robert Field wrote: >>>>> Ok. Go ahead and incorporate the text. I'll make a separate bug to >>>>> sync >>>>> the representation of keys in the other help entries. >>>> >>>> An updated patch (with your text): >>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.03/ >>>> Delta from previous patch: >>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.02.03/ >>>> >>>> Thanks for the comments and for the text! Any feedback is welcome. >>>> >>>> Thanks, >>>> Jan >>>> >>>> >>>>> >>>>> Robert >>>>> >>>>> >>>>> On December 9, 2018 6:36:26 AM Jan Lahoda >>>>> wrote: >>>>> >>>>>> Hi Robert, >>>>>> >>>>>> On 9.12.2018 02:40, Robert Field wrote: >>>>>>> OK, here is my thinking on a /help keys entry. Note: I'm using the >>>>>> >>>>>> I think this looks great! >>>>>> >>>>>>> representation for keys used by the User's Guide -- which I >>>>>>> assume is >>>>>>> the official tech pubs style -- seems we should be consistent; If >>>>>>> we are >>>>>>> however, the other /help entries should be brought into compliance >>>>>>> (they >>>>>>> seem to be all over the map already). May make sense to spin >>>>>>> this off >>>>>>> as a separate bug, which I'd be happy to take on. >>>>>> >>>>>> I'm happy with a separate bug, if you prefer/are OK with that. Or >>>>>> I can >>>>>> incorporate the text into upgrade patch, whichever you prefer. >>>>>> >>>>>> I've updated my current patch with only a rename "editing" -> "keys" >>>>>> and >>>>>> the fix to the jshell tool name: >>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.02/ >>>>>> >>>>>> Delta from last: >>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.01.02/ >>>>>> >>>>>> Jan >>>>>> >>>>>>> >>>>>>> Comments welcome --- >>>>>>> >>>>>>> __________________________________________________________________________________________________________________________ >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> /help keys >>>>>>> ========== >>>>>>> >>>>>>> The jshell tool provides line editing support to allow you to >>>>>>> navigate >>>>>>> within and edit snippets and commands. The current >>>>>>> command/snippet can >>>>>>> be edited, or prior commands/snippets can be retrieved from history, >>>>>>> edited, and executed. This support is similar to readline/editline >>>>>>> with >>>>>>> simple emacs-like bindings. There are also jshell tool specific key >>>>>>> sequences. >>>>>>> >>>>>>> --- Line and history navigation --- >>>>>>> >>>>>>> Return >>>>>>> Enters the current snippet >>>>>>> Left-arrow or Ctrl+B >>>>>>> Moves backward one character >>>>>>> Right-arrow or Ctrl+F >>>>>>> Moves forward one character >>>>>>> Up-arrow or Ctrl+P >>>>>>> Moves up one line, backward through history >>>>>>> Down arrow or Ctrl+N >>>>>>> Moves down one line, forward through history >>>>>>> Ctrl+A >>>>>>> Moves to the beginning of the line >>>>>>> Ctrl+E >>>>>>> Moves to the end of the line >>>>>>> Meta+B >>>>>>> Moves backward one word >>>>>>> Meta+F >>>>>>> Moves forward one word >>>>>>> Ctrl+R >>>>>>> Search backward through history >>>>>>> >>>>>>> >>>>>>> --- Line and history basic editing --- >>>>>>> >>>>>>> Meta+Return or Ctrl+Return (depending on platform) >>>>>>> Insert a new line in snippet >>>>>>> Ctrl+_ (underscore may require shift key) or Ctrl-X then Ctrl-U >>>>>>> Undo edit - repeat to undo more edits >>>>>>> Delete >>>>>>> Deletes the character at or after the cursor, depending on the >>>>>>> operating system >>>>>>> Backspace >>>>>>> Deletes the character before the cursor >>>>>>> Ctrl+K >>>>>>> Deletes the text from the cursor to the end of the line >>>>>>> Meta+D >>>>>>> Deletes the text from the cursor to the end of the word >>>>>>> Ctrl+W >>>>>>> Deletes the text from the cursor to the previous white space >>>>>>> Ctrl+Y >>>>>>> Pastes the most recently deleted text into the line >>>>>>> Meta+Y >>>>>>> After Ctrl+Y, Meta+Y cycles through previously deleted text >>>>>>> Ctrl+X then Ctrl+K >>>>>>> Delete whole snippet >>>>>>> >>>>>>> >>>>>>> --- Shortcuts for jshell tool --- >>>>>>> >>>>>>> For details, see: /help shortcuts >>>>>>> >>>>>>> Tab >>>>>>> Complete Java identifier or jshell command >>>>>>> Shift+Tab then v >>>>>>> Convert expression to variable declaration >>>>>>> Shift+Tab then m >>>>>>> Convert statement to method declaration >>>>>>> Shift+Tab then i >>>>>>> Add imports for this identifier >>>>>>> >>>>>>> >>>>>>> --- More line and history editing --- >>>>>>> >>>>>>> Ctrl+L >>>>>>> Clear screen and reprint snippet >>>>>>> Ctrl+U >>>>>>> Kill whole line >>>>>>> Ctrl+T >>>>>>> Transpose characters >>>>>>> Ctrl+X then Ctrl+B >>>>>>> Navigate to matching bracket, parenthesis, ... >>>>>>> Ctrl+X then = >>>>>>> Enter show current character position mode >>>>>>> Ctrl+X then Ctrl+O >>>>>>> Toggle overwrite characters vs insert characters >>>>>>> Meta+C >>>>>>> Capitalize word >>>>>>> Meta+U >>>>>>> Convert word to uppercase >>>>>>> Meta+L >>>>>>> Convert word to lowercase >>>>>>> Meta+0 through Meta+9 then key >>>>>>> Repeat the specified number of times >>>>>>> >>>>>>> Where, for example, "Ctrl+A" means hold down the control key and >>>>>>> press A. >>>>>>> Where "Meta" is "Alt" on many keyboards. >>>>>>> Line editing support is derived from JLine 3. >>>>>>> >>>>>>> _______________________________________________________________________________ >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -Robert >>>>>>> >>>>>>> >>>>>>> >>>>>>> On 12/8/18 11:47 AM, Jan Lahoda wrote: >>>>>>>> On 8.12.2018 20:39, Robert Field wrote: >>>>>>>>> Thanks for updating. >>>>>>>>> >>>>>>>>> Good to have /help for line editing keys, however: >>>>>>>>> (1) The supported keys should be listed without requiring that >>>>>>>>> the >>>>>>>>> user knows or looks-up readline. More so, since only some readline >>>>>>>>> keys >>>>>>>>> are supposed. >>>>>>>>> (2) "/edit" is a command, so with this change, typing "/help >>>>>>>>> edit" >>>>>>>>> would give both the /edit and editing help -- which would be >>>>>>>>> confusing. >>>>>>>>> I suggest "/help keys", there are no "k" help items. >>>>>>>> >>>>>>>> Will do. >>>>>>>> >>>>>>>>> (3) In jshell tool online docs the tool is spelled "jshell >>>>>>>>> tool" >>>>>>>>> I'd be happy to write up suggested text. >>>>>>>> >>>>>>>> Thanks, that would be very welcome! >>>>>>>> >>>>>>>>> >>>>>>>>> As to the alternative patch: I understand the motivation, it >>>>>>>>> would be >>>>>>>>> nice to just use the natural "Enter" as new line. Unfortunately >>>>>>>>> it's >>>>>>>>> functionality is then overloaded. I believe the alternative >>>>>>>>> will be >>>>>>>>> confusing and awkward: >>>>>>>>> (1) It breaks backward compatibility in user experience, Enter >>>>>>>>> has >>>>>>>>> always been accept/evaluate >>>>>>>>> (2) It would be very awkward and non-intuitive (particularly >>>>>>>>> in a >>>>>>>>> long multiline snippet) to have to navigate to the end of the >>>>>>>>> snippet to >>>>>>>>> accept. >>>>>>>>> Note: must be the end both vertically and horizontally. >>>>>>>>> (3) It is inconsistent: Mid snippet Enter on one line does >>>>>>>>> accept. >>>>>>>>> However, on a continuation line (say after "int x =") it adds a >>>>>>>>> new >>>>>>>>> line >>>>>>>>> instead. >>>>>>>>> (4) It doesn't solve the problem for the most common >>>>>>>>> location for >>>>>>>>> adding a new line, the end of snippet -- thus introducing more >>>>>>>>> inconsistency. >>>>>>>> >>>>>>>> Ok. This was meant more as a backup in case there's no reasonable >>>>>>>> shortcut we could use to add new lines. >>>>>>>> >>>>>>>> Thanks for the comments! >>>>>>>> >>>>>>>> Jan >>>>>>>> >>>>>>>>> >>>>>>>>> Thanks, >>>>>>>>> Robert >>>>>>>>> >>>>>>>>> >>>>>>>>> On 12/8/18 7:21 AM, Jan Lahoda wrote: >>>>>>>>>> Hi, >>>>>>>>>> >>>>>>>>>> I've updated the patch to reflect the comments so far, the >>>>>>>>>> current >>>>>>>>>> version is here: >>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01/ >>>>>>>>>> Delta since the previous version is here for convenience: >>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01/ >>>>>>>>>> >>>>>>>>>> In this version, while editing a snippet, a new line can be added >>>>>>>>>> using Alt-Enter (on platforms that support that), or >>>>>>>>>> Ctrl-Enter (on >>>>>>>>>> Windows). >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> And alternative patch is here: >>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01a/ >>>>>>>>>> Delta: >>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01a/ >>>>>>>>>> >>>>>>>>>> In the alternative version, Enter will only "confirm" multi-line >>>>>>>>>> snippet when the cursor is at the end of the snippet, >>>>>>>>>> otherwise it >>>>>>>>>> will add a new line (so that a special shortcut is not needed; >>>>>>>>>> but a >>>>>>>>>> snippet cannot be "confirmed" by pressing Enter in the middle >>>>>>>>>> of a >>>>>>>>>> multi-line snippet.) >>>>>>>>>> >>>>>>>>>> The only difference between the .01 and .01a patches is the way >>>>>>>>>> they >>>>>>>>>> allow to add new lines into the multi-line snippets. Other >>>>>>>>>> changes >>>>>>>>>> are >>>>>>>>>> the same. >>>>>>>>>> >>>>>>>>>> Any feedback on this is welcome. >>>>>>>>>> >>>>>>>>>> Thanks! >>>>>>>>>> >>>>>>>>>> Jan >>>>>>>>>> >>>>>>>>>> On 5.12.2018 18:18, Jan Lahoda wrote: >>>>>>>>>>> Hi Robert, >>>>>>>>>>> >>>>>>>>>>> On 4.12.2018 23:59, Robert Field wrote: >>>>>>>>>>>> I saw no issues with JShell tool and test portions of the >>>>>>>>>>>> webrev. I >>>>>>>>>>>> did >>>>>>>>>>>> not review the nashorn changes. >>>>>>>>>>> >>>>>>>>>>> Thanks for looking at this! >>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> Testing it: editing multi-line snippets is vastly easier and >>>>>>>>>>>> more >>>>>>>>>>>> intuitive. >>>>>>>>>>>> There is one issue, with the old mechanism, as horridly clunky >>>>>>>>>>>> as it >>>>>>>>>>>> was, you could add new lines of code (a frequently needed >>>>>>>>>>>> functionality). >>>>>>>>>>>> Since is accept, I could find no way to add lines with >>>>>>>>>>>> this >>>>>>>>>>>> JLine 3 version. Thoughts? >>>>>>>>>>> >>>>>>>>>>> One possibility that comes to mind: pressing Enter inside the >>>>>>>>>>> snippet >>>>>>>>>>> would add a new line, Enter at the very end of a (complete) >>>>>>>>>>> snippet >>>>>>>>>>> would confirm that snippet. Could be fairly >>>>>>>>>>> convenient/intuitive. >>>>>>>>>>> What >>>>>>>>>>> do you think? >>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> I looked into readline commands as an approach to addressing >>>>>>>>>>>> this, >>>>>>>>>>>> found >>>>>>>>>>>> nothing. However, most readline commands worked. Ctrl-u >>>>>>>>>>>> however >>>>>>>>>>>> did >>>>>>>>>>>> not >>>>>>>>>>>> behave as documented in readline (instead deleting to the >>>>>>>>>>>> beginning of >>>>>>>>>>>> the line). I notice that the there is zero in-command >>>>>>>>>>>> documentation of >>>>>>>>>>>> command-line editing -- not even a mention. Independent >>>>>>>>>>>> from the >>>>>>>>>>>> review >>>>>>>>>>>> of this port, it seems we should have in-command >>>>>>>>>>>> documentation of >>>>>>>>>>>> command editing -- even more so now that multiline editing is >>>>>>>>>>>> useful. >>>>>>>>>>> >>>>>>>>>>> This is about enhancing /help, right? I'll see what I can do. >>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> The JShell User Manual will also need a little edit in the >>>>>>>>>>>> History >>>>>>>>>>>> Navigation section. >>>>>>>>>>> >>>>>>>>>>> Where is that? >>>>>>>>>>> >>>>>>>>>>> Thanks, >>>>>>>>>>> Jan >>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> -Robert >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>>>>>>>>>>>> Hi, >>>>>>>>>>>>> >>>>>>>>>>>>> I'd like to update the internal JLine used by JShell and >>>>>>>>>>>>> jjs to >>>>>>>>>>>>> JLine >>>>>>>>>>>>> 3.9.0. Two notable advantages of this version is multi-line >>>>>>>>>>>>> snippet >>>>>>>>>>>>> editing and better UI on Windows (escape sequence support on >>>>>>>>>>>>> Windows). >>>>>>>>>>>>> As a consequence, this patch drops EditingHistory, as it does >>>>>>>>>>>>> not >>>>>>>>>>>>> seem >>>>>>>>>>>>> to be needed anymore. >>>>>>>>>>>>> >>>>>>>>>>>>> JBS: >>>>>>>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>>>>>>>>>>>> >>>>>>>>>>>>> The full patch is here: >>>>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> To make the changes more clear, I've split it into two: >>>>>>>>>>>>> -replacement of existing JLine with the new on in >>>>>>>>>>>>> jdk.internal.le, no >>>>>>>>>>>>> changes to JLine code: >>>>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>>>>>>>>>>>> >>>>>>>>>>>>> -tweaks to JLine (repackaging, eliminating references to >>>>>>>>>>>>> j.u.l.Logger, >>>>>>>>>>>>> adding hooks to wrap input streams with our stop-detecting >>>>>>>>>>>>> input >>>>>>>>>>>>> stream, adding unicode escapes to unicode characters, support >>>>>>>>>>>>> for >>>>>>>>>>>>> Windows without JNA), adjustments to JShell and jjs >>>>>>>>>>>>> (unfortunately, >>>>>>>>>>>>> 3.9.0 is not compatible with the JLine 2 branch, so the >>>>>>>>>>>>> changes >>>>>>>>>>>>> are >>>>>>>>>>>>> substantial): >>>>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>>>>>>>>>>>> >>>>>>>>>>>>> Any feedback is welcome! >>>>>>>>>>>>> >>>>>>>>>>>>> Thanks, >>>>>>>>>>>>> Jan >>>>> >>>>> >>>>> From sundararajan.athijegannathan at oracle.com Mon Dec 10 13:52:08 2018 From: sundararajan.athijegannathan at oracle.com (Sundararajan Athijegannathan) Date: Mon, 10 Dec 2018 19:22:08 +0530 Subject: RFR: JDK-8214491: Upgrade to JLine 3.9.0 In-Reply-To: <5C0E6437.8000307@oracle.com> References: <5C0054CF.3040009@oracle.com> <5C080880.2080407@oracle.com> <5C0BE192.8010404@oracle.com> <1fd7c4d3-b446-f695-025e-3ef3c0980744@oracle.com> <5C0C1FBA.2050602@oracle.com> <6eef7f37-897c-7f02-f430-13400cdbc80a@oracle.com> <5C0D2866.6020105@oracle.com> <16793a02408.2794.4011f3a8741ca2aabce58b8b81f42d24@oracle.com> <5C0D9B1A.3080409@oracle.com> <5C0DF79F.7050500@oracle.com> <5C0E343C.8000705@oracle.com> <5C0E3C8B.2040903@oracle.com> <5C0E6437.8000307@oracle.com> Message-ID: <5C0E6F87.3020206@oracle.com> Thanks for fixing! Interactive mode manual testing is fine - tab completion, multi-line edit, built-in/external editor, history object all seem fine. +1 Thanks, -Sundar On 10/12/18, 6:33 PM, Jan Lahoda wrote: > Thanks for testing Sundar! > > I've tried to update the jjs completion handling to fix this problem > here: > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.05/ > > Delta from previous patch: > http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.04.05/ > > What do you think? > > Thanks, > Jan > > On 10.12.2018 11:14, Sundararajan Athijegannathan wrote: >> Hi Jan, >> >> Tests are fine. Because there are not many UI automated tests for jjs, I >> tried to manually test few features. >> >> Tab-completion seems to be messed up. Only top-level completion seems to >> work. Property/method completion and inside multi-line method etc. don't >> seem to work. >> >> Thanks, >> -Sundar >> >> >> On 10/12/18, 3:09 PM, Jan Lahoda wrote: >>> Hi Sundar, >>> >>> Thanks for finding the problem! I was running tier1-3 tests, but seems >>> these are not there. >>> >>> Seems the problem is how JLine(3) handles "dumb" terminals, it >>> probably does not affect interactive use. So, adjusting the expected >>> output should hopefully be OK. >>> >>> Updated patch: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.04/index.html >>> Delta from previous: >>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.03.04/ >>> >>> How does this look? >>> >>> Thanks! >>> >>> Jan >>> >>> On 10.12.2018 06:20, Sundararajan Athijegannathan wrote: >>>> I built jdk and ran nashorn tests with this patch. Two tests fail with >>>> this patch - but those tests pass without this patch: >>>> >>>> [testng] Test test/nashorn/script/nosecurity/JDK-8055034.js failed >>>> at line 1 - >>>> [testng] expected: 'jjs> var x = Object.create(null);' >>>> [testng] found: 'jjs> var x = Object.create(null)jjs> jjs> >>>> print('PASSED')PASSED' >>>> >>>> [testng] Test test/nashorn/script/nosecurity/JDK-8130127.js failed >>>> at line 5 - >>>> [testng] expected: 'jjs> print('hello')' >>>> [testng] found: 'jjs> print('hello')hello' >>>> >>>> Both tests involving exec'ing jjs and comparing with the expected >>>> output. Either we need to add these to failing tests and/or address >>>> the >>>> issue before push. >>>> >>>> Thanks, >>>> -Sundar >>>> >>>> On 10/12/18, 4:15 AM, Jan Lahoda wrote: >>>>> On 9.12.2018 16:40, Robert Field wrote: >>>>>> Ok. Go ahead and incorporate the text. I'll make a separate bug to >>>>>> sync >>>>>> the representation of keys in the other help entries. >>>>> >>>>> An updated patch (with your text): >>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.03/ >>>>> Delta from previous patch: >>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.02.03/ >>>>> >>>>> Thanks for the comments and for the text! Any feedback is welcome. >>>>> >>>>> Thanks, >>>>> Jan >>>>> >>>>> >>>>>> >>>>>> Robert >>>>>> >>>>>> >>>>>> On December 9, 2018 6:36:26 AM Jan Lahoda >>>>>> wrote: >>>>>> >>>>>>> Hi Robert, >>>>>>> >>>>>>> On 9.12.2018 02:40, Robert Field wrote: >>>>>>>> OK, here is my thinking on a /help keys entry. Note: I'm using >>>>>>>> the >>>>>>> >>>>>>> I think this looks great! >>>>>>> >>>>>>>> representation for keys used by the User's Guide -- which I >>>>>>>> assume is >>>>>>>> the official tech pubs style -- seems we should be consistent; If >>>>>>>> we are >>>>>>>> however, the other /help entries should be brought into compliance >>>>>>>> (they >>>>>>>> seem to be all over the map already). May make sense to spin >>>>>>>> this off >>>>>>>> as a separate bug, which I'd be happy to take on. >>>>>>> >>>>>>> I'm happy with a separate bug, if you prefer/are OK with that. Or >>>>>>> I can >>>>>>> incorporate the text into upgrade patch, whichever you prefer. >>>>>>> >>>>>>> I've updated my current patch with only a rename "editing" -> >>>>>>> "keys" >>>>>>> and >>>>>>> the fix to the jshell tool name: >>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.02/ >>>>>>> >>>>>>> Delta from last: >>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.01.02/ >>>>>>> >>>>>>> Jan >>>>>>> >>>>>>>> >>>>>>>> Comments welcome --- >>>>>>>> >>>>>>>> __________________________________________________________________________________________________________________________ >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> /help keys >>>>>>>> ========== >>>>>>>> >>>>>>>> The jshell tool provides line editing support to allow you to >>>>>>>> navigate >>>>>>>> within and edit snippets and commands. The current >>>>>>>> command/snippet can >>>>>>>> be edited, or prior commands/snippets can be retrieved from >>>>>>>> history, >>>>>>>> edited, and executed. This support is similar to readline/editline >>>>>>>> with >>>>>>>> simple emacs-like bindings. There are also jshell tool >>>>>>>> specific key >>>>>>>> sequences. >>>>>>>> >>>>>>>> --- Line and history navigation --- >>>>>>>> >>>>>>>> Return >>>>>>>> Enters the current snippet >>>>>>>> Left-arrow or Ctrl+B >>>>>>>> Moves backward one character >>>>>>>> Right-arrow or Ctrl+F >>>>>>>> Moves forward one character >>>>>>>> Up-arrow or Ctrl+P >>>>>>>> Moves up one line, backward through history >>>>>>>> Down arrow or Ctrl+N >>>>>>>> Moves down one line, forward through history >>>>>>>> Ctrl+A >>>>>>>> Moves to the beginning of the line >>>>>>>> Ctrl+E >>>>>>>> Moves to the end of the line >>>>>>>> Meta+B >>>>>>>> Moves backward one word >>>>>>>> Meta+F >>>>>>>> Moves forward one word >>>>>>>> Ctrl+R >>>>>>>> Search backward through history >>>>>>>> >>>>>>>> >>>>>>>> --- Line and history basic editing --- >>>>>>>> >>>>>>>> Meta+Return or Ctrl+Return (depending on platform) >>>>>>>> Insert a new line in snippet >>>>>>>> Ctrl+_ (underscore may require shift key) or Ctrl-X then Ctrl-U >>>>>>>> Undo edit - repeat to undo more edits >>>>>>>> Delete >>>>>>>> Deletes the character at or after the cursor, depending on the >>>>>>>> operating system >>>>>>>> Backspace >>>>>>>> Deletes the character before the cursor >>>>>>>> Ctrl+K >>>>>>>> Deletes the text from the cursor to the end of the line >>>>>>>> Meta+D >>>>>>>> Deletes the text from the cursor to the end of the word >>>>>>>> Ctrl+W >>>>>>>> Deletes the text from the cursor to the previous white space >>>>>>>> Ctrl+Y >>>>>>>> Pastes the most recently deleted text into the line >>>>>>>> Meta+Y >>>>>>>> After Ctrl+Y, Meta+Y cycles through previously deleted text >>>>>>>> Ctrl+X then Ctrl+K >>>>>>>> Delete whole snippet >>>>>>>> >>>>>>>> >>>>>>>> --- Shortcuts for jshell tool --- >>>>>>>> >>>>>>>> For details, see: /help shortcuts >>>>>>>> >>>>>>>> Tab >>>>>>>> Complete Java identifier or jshell command >>>>>>>> Shift+Tab then v >>>>>>>> Convert expression to variable declaration >>>>>>>> Shift+Tab then m >>>>>>>> Convert statement to method declaration >>>>>>>> Shift+Tab then i >>>>>>>> Add imports for this identifier >>>>>>>> >>>>>>>> >>>>>>>> --- More line and history editing --- >>>>>>>> >>>>>>>> Ctrl+L >>>>>>>> Clear screen and reprint snippet >>>>>>>> Ctrl+U >>>>>>>> Kill whole line >>>>>>>> Ctrl+T >>>>>>>> Transpose characters >>>>>>>> Ctrl+X then Ctrl+B >>>>>>>> Navigate to matching bracket, parenthesis, ... >>>>>>>> Ctrl+X then = >>>>>>>> Enter show current character position mode >>>>>>>> Ctrl+X then Ctrl+O >>>>>>>> Toggle overwrite characters vs insert characters >>>>>>>> Meta+C >>>>>>>> Capitalize word >>>>>>>> Meta+U >>>>>>>> Convert word to uppercase >>>>>>>> Meta+L >>>>>>>> Convert word to lowercase >>>>>>>> Meta+0 through Meta+9 then key >>>>>>>> Repeat the specified number of times >>>>>>>> >>>>>>>> Where, for example, "Ctrl+A" means hold down the control key and >>>>>>>> press A. >>>>>>>> Where "Meta" is "Alt" on many keyboards. >>>>>>>> Line editing support is derived from JLine 3. >>>>>>>> >>>>>>>> _______________________________________________________________________________ >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -Robert >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On 12/8/18 11:47 AM, Jan Lahoda wrote: >>>>>>>>> On 8.12.2018 20:39, Robert Field wrote: >>>>>>>>>> Thanks for updating. >>>>>>>>>> >>>>>>>>>> Good to have /help for line editing keys, however: >>>>>>>>>> (1) The supported keys should be listed without requiring >>>>>>>>>> that >>>>>>>>>> the >>>>>>>>>> user knows or looks-up readline. More so, since only some >>>>>>>>>> readline >>>>>>>>>> keys >>>>>>>>>> are supposed. >>>>>>>>>> (2) "/edit" is a command, so with this change, typing "/help >>>>>>>>>> edit" >>>>>>>>>> would give both the /edit and editing help -- which would be >>>>>>>>>> confusing. >>>>>>>>>> I suggest "/help keys", there are no "k" help items. >>>>>>>>> >>>>>>>>> Will do. >>>>>>>>> >>>>>>>>>> (3) In jshell tool online docs the tool is spelled "jshell >>>>>>>>>> tool" >>>>>>>>>> I'd be happy to write up suggested text. >>>>>>>>> >>>>>>>>> Thanks, that would be very welcome! >>>>>>>>> >>>>>>>>>> >>>>>>>>>> As to the alternative patch: I understand the motivation, it >>>>>>>>>> would be >>>>>>>>>> nice to just use the natural "Enter" as new line. Unfortunately >>>>>>>>>> it's >>>>>>>>>> functionality is then overloaded. I believe the alternative >>>>>>>>>> will be >>>>>>>>>> confusing and awkward: >>>>>>>>>> (1) It breaks backward compatibility in user experience, >>>>>>>>>> Enter >>>>>>>>>> has >>>>>>>>>> always been accept/evaluate >>>>>>>>>> (2) It would be very awkward and non-intuitive (particularly >>>>>>>>>> in a >>>>>>>>>> long multiline snippet) to have to navigate to the end of the >>>>>>>>>> snippet to >>>>>>>>>> accept. >>>>>>>>>> Note: must be the end both vertically and horizontally. >>>>>>>>>> (3) It is inconsistent: Mid snippet Enter on one line does >>>>>>>>>> accept. >>>>>>>>>> However, on a continuation line (say after "int x =") it adds a >>>>>>>>>> new >>>>>>>>>> line >>>>>>>>>> instead. >>>>>>>>>> (4) It doesn't solve the problem for the most common >>>>>>>>>> location for >>>>>>>>>> adding a new line, the end of snippet -- thus introducing more >>>>>>>>>> inconsistency. >>>>>>>>> >>>>>>>>> Ok. This was meant more as a backup in case there's no reasonable >>>>>>>>> shortcut we could use to add new lines. >>>>>>>>> >>>>>>>>> Thanks for the comments! >>>>>>>>> >>>>>>>>> Jan >>>>>>>>> >>>>>>>>>> >>>>>>>>>> Thanks, >>>>>>>>>> Robert >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On 12/8/18 7:21 AM, Jan Lahoda wrote: >>>>>>>>>>> Hi, >>>>>>>>>>> >>>>>>>>>>> I've updated the patch to reflect the comments so far, the >>>>>>>>>>> current >>>>>>>>>>> version is here: >>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01/ >>>>>>>>>>> Delta since the previous version is here for convenience: >>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01/ >>>>>>>>>>> >>>>>>>>>>> In this version, while editing a snippet, a new line can be >>>>>>>>>>> added >>>>>>>>>>> using Alt-Enter (on platforms that support that), or >>>>>>>>>>> Ctrl-Enter (on >>>>>>>>>>> Windows). >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> And alternative patch is here: >>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.01a/ >>>>>>>>>>> Delta: >>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.delta.00.01a/ >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> In the alternative version, Enter will only "confirm" >>>>>>>>>>> multi-line >>>>>>>>>>> snippet when the cursor is at the end of the snippet, >>>>>>>>>>> otherwise it >>>>>>>>>>> will add a new line (so that a special shortcut is not needed; >>>>>>>>>>> but a >>>>>>>>>>> snippet cannot be "confirmed" by pressing Enter in the middle >>>>>>>>>>> of a >>>>>>>>>>> multi-line snippet.) >>>>>>>>>>> >>>>>>>>>>> The only difference between the .01 and .01a patches is the way >>>>>>>>>>> they >>>>>>>>>>> allow to add new lines into the multi-line snippets. Other >>>>>>>>>>> changes >>>>>>>>>>> are >>>>>>>>>>> the same. >>>>>>>>>>> >>>>>>>>>>> Any feedback on this is welcome. >>>>>>>>>>> >>>>>>>>>>> Thanks! >>>>>>>>>>> >>>>>>>>>>> Jan >>>>>>>>>>> >>>>>>>>>>> On 5.12.2018 18:18, Jan Lahoda wrote: >>>>>>>>>>>> Hi Robert, >>>>>>>>>>>> >>>>>>>>>>>> On 4.12.2018 23:59, Robert Field wrote: >>>>>>>>>>>>> I saw no issues with JShell tool and test portions of the >>>>>>>>>>>>> webrev. I >>>>>>>>>>>>> did >>>>>>>>>>>>> not review the nashorn changes. >>>>>>>>>>>> >>>>>>>>>>>> Thanks for looking at this! >>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> Testing it: editing multi-line snippets is vastly easier and >>>>>>>>>>>>> more >>>>>>>>>>>>> intuitive. >>>>>>>>>>>>> There is one issue, with the old mechanism, as horridly >>>>>>>>>>>>> clunky >>>>>>>>>>>>> as it >>>>>>>>>>>>> was, you could add new lines of code (a frequently needed >>>>>>>>>>>>> functionality). >>>>>>>>>>>>> Since is accept, I could find no way to add lines >>>>>>>>>>>>> with >>>>>>>>>>>>> this >>>>>>>>>>>>> JLine 3 version. Thoughts? >>>>>>>>>>>> >>>>>>>>>>>> One possibility that comes to mind: pressing Enter inside the >>>>>>>>>>>> snippet >>>>>>>>>>>> would add a new line, Enter at the very end of a (complete) >>>>>>>>>>>> snippet >>>>>>>>>>>> would confirm that snippet. Could be fairly >>>>>>>>>>>> convenient/intuitive. >>>>>>>>>>>> What >>>>>>>>>>>> do you think? >>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> I looked into readline commands as an approach to addressing >>>>>>>>>>>>> this, >>>>>>>>>>>>> found >>>>>>>>>>>>> nothing. However, most readline commands worked. Ctrl-u >>>>>>>>>>>>> however >>>>>>>>>>>>> did >>>>>>>>>>>>> not >>>>>>>>>>>>> behave as documented in readline (instead deleting to the >>>>>>>>>>>>> beginning of >>>>>>>>>>>>> the line). I notice that the there is zero in-command >>>>>>>>>>>>> documentation of >>>>>>>>>>>>> command-line editing -- not even a mention. Independent >>>>>>>>>>>>> from the >>>>>>>>>>>>> review >>>>>>>>>>>>> of this port, it seems we should have in-command >>>>>>>>>>>>> documentation of >>>>>>>>>>>>> command editing -- even more so now that multiline editing is >>>>>>>>>>>>> useful. >>>>>>>>>>>> >>>>>>>>>>>> This is about enhancing /help, right? I'll see what I can do. >>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> The JShell User Manual will also need a little edit in the >>>>>>>>>>>>> History >>>>>>>>>>>>> Navigation section. >>>>>>>>>>>> >>>>>>>>>>>> Where is that? >>>>>>>>>>>> >>>>>>>>>>>> Thanks, >>>>>>>>>>>> Jan >>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> -Robert >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> On 11/29/18 1:06 PM, Jan Lahoda wrote: >>>>>>>>>>>>>> Hi, >>>>>>>>>>>>>> >>>>>>>>>>>>>> I'd like to update the internal JLine used by JShell and >>>>>>>>>>>>>> jjs to >>>>>>>>>>>>>> JLine >>>>>>>>>>>>>> 3.9.0. Two notable advantages of this version is multi-line >>>>>>>>>>>>>> snippet >>>>>>>>>>>>>> editing and better UI on Windows (escape sequence support on >>>>>>>>>>>>>> Windows). >>>>>>>>>>>>>> As a consequence, this patch drops EditingHistory, as it >>>>>>>>>>>>>> does >>>>>>>>>>>>>> not >>>>>>>>>>>>>> seem >>>>>>>>>>>>>> to be needed anymore. >>>>>>>>>>>>>> >>>>>>>>>>>>>> JBS: >>>>>>>>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8214491 >>>>>>>>>>>>>> >>>>>>>>>>>>>> The full patch is here: >>>>>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00/ >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> To make the changes more clear, I've split it into two: >>>>>>>>>>>>>> -replacement of existing JLine with the new on in >>>>>>>>>>>>>> jdk.internal.le, no >>>>>>>>>>>>>> changes to JLine code: >>>>>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.replace/ >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> -tweaks to JLine (repackaging, eliminating references to >>>>>>>>>>>>>> j.u.l.Logger, >>>>>>>>>>>>>> adding hooks to wrap input streams with our stop-detecting >>>>>>>>>>>>>> input >>>>>>>>>>>>>> stream, adding unicode escapes to unicode characters, >>>>>>>>>>>>>> support >>>>>>>>>>>>>> for >>>>>>>>>>>>>> Windows without JNA), adjustments to JShell and jjs >>>>>>>>>>>>>> (unfortunately, >>>>>>>>>>>>>> 3.9.0 is not compatible with the JLine 2 branch, so the >>>>>>>>>>>>>> changes >>>>>>>>>>>>>> are >>>>>>>>>>>>>> substantial): >>>>>>>>>>>>>> http://cr.openjdk.java.net/~jlahoda/8214491/webrev.00.update/ >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> Any feedback is welcome! >>>>>>>>>>>>>> >>>>>>>>>>>>>> Thanks, >>>>>>>>>>>>>> Jan >>>>>> >>>>>> >>>>>> From jan.lahoda at oracle.com Tue Dec 11 14:12:26 2018 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Tue, 11 Dec 2018 15:12:26 +0100 Subject: RFR: JDK-8215218: Test ToolTabSnippetTest.testCleaningCompletionTODO failed on Windows Message-ID: <5C0FC5CA.2010904@oracle.com> Hi, After JLine 3.9.0 upgrade (JDK-8214491), the ToolTabSnippetTest.testCleaningCompletionTODO test failed on Windows (I ran the tests several times before pushing the change, but sadly did not see this one, so it may be random). From the log, it is not quite clear what is the problem. The exception is: java.lang.InterruptedException at java.base/java.lang.Object.wait(Native Method) at java.base/java.lang.Thread.join(Thread.java:1302) at UITesting.doRunTest(UITesting.java:116) at ToolTabSnippetTest.testCleaningCompletionTODO(ToolTabSnippetTest.java:212) The UITesting.doRunTest is there trying to do Thread.join. It is not quite clear if the problem is just he InterruptedException from the join, or is there was already a different failure before, hidden by this one. So, I'd like to propose that the InterruptedException is handled by the test (as we do on other places), and that should either solve the problem, or we will hopefully start to see the real underlying problem. Proposed webrev: http://cr.openjdk.java.net/~jlahoda/8215218/webrev.00/ JBS: https://bugs.openjdk.java.net/browse/JDK-8215218 (Running tests with the patch as well, in case it would reveal something.) Thanks, Jan From jan.lahoda at oracle.com Wed Dec 12 12:09:35 2018 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Wed, 12 Dec 2018 13:09:35 +0100 Subject: RFR: JDK-8215243: JShell tests failing intermitently with "Problem cleaning up the following threads:" Message-ID: <5C10FA7F.6080008@oracle.com> Hi, After the JLine upgrade, the JShell tests tend to randomly fail with errors like: JavaTest Message: Problem cleaning up the following threads: Thread-74 at java.base at 12-internal/java.lang.Object.wait(Native Method) at java.base at 12-internal/java.lang.Object.wait(Object.java:328) at app/jdk.jshell at 12-internal/jdk.internal.jshell.tool.StopDetectingInputStream.read(StopDetectingInputStream.java:98) at app/jdk.jshell at 12-internal/jdk.internal.jshell.tool.ConsoleIOContext$TestTerminal.lambda$new$0(ConsoleIOContext.java:1212) at app/jdk.jshell at 12-internal/jdk.internal.jshell.tool.ConsoleIOContext$TestTerminal$$Lambda$245/0x0000000100236040.run(Unknown Source) at java.base at 12-internal/java.lang.Thread.run(Thread.java:835) Sadly, I didn't see that on my runs so far, but it seems to happen frequently enough on the continuous builders. I was looking at the StopDetectingInputStream and related classes for potential problems. When the ConsoleIOContext is closed, it shutdowns the StopDetectingInputStream, which sets its state to CLOSED, and the read method then returns with -1. I didn't find a problem with this part. But, in StopDetecctingInputStream.write, there is: if (state != State.BUFFER) { state = State.WAIT; } This could potentially un-close the StopDetectingInputStream if the write method is called on a closed instance, the instance would be "reopened", and if things would happen in a wrong sequence/order, the "read" method could wait indefinitely, presumably leading to the problem with cleaning up the thread. My proposal is to fix this by not re-setting the state CLOSED back to WAIT even if write is called on a closed StopDetectingInputStream. I am not sure if it will help with the problem on builders, but appears to be a correct thing to do anyway. Webrev: http://cr.openjdk.java.net/~jlahoda/8215243/webrev.00/ JBS: https://bugs.openjdk.java.net/browse/JDK-8215243 What do you think? Thanks! Jan From jan.lahoda at oracle.com Wed Dec 12 15:40:58 2018 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Wed, 12 Dec 2018 16:40:58 +0100 Subject: RFR: JDK-8215244: jdk/jshell/ToolBasicTest.java testHistoryReference failed Message-ID: <5C112C0A.3090809@oracle.com> Hi, Another problem with a test intermittently failing. The failure is: test ToolBasicTest.testHistoryReference(): failure java.lang.AssertionError: command output: /history. expected [/debug 0 System.err.println(1) System.err.println(2) System.err.println(1) /history] but found [System.err.println(1) System.err.println(2) System.err.println(1) /history] The first (synthetic) command is missing ("/debug 0") in the current session history. The detection of which entries are load from previous sessions and which belong to the current session is based on the Instant when the entry was added. But it seems that maybe(?) the first command may have the same instant as the entries load for the previous sessions. So, I'd like to use Instant.MIN instead of Instant.now() as the timestamp for the history entries from the previous sessions, that should help us distinguish the new and old entries. Webrev: http://cr.openjdk.java.net/~jlahoda/8215244/webrev.00/ JBS: https://bugs.openjdk.java.net/browse/JDK-8215244 What do you think? Thanks, Jan From robert.field at oracle.com Thu Dec 13 01:50:55 2018 From: robert.field at oracle.com (Robert Field) Date: Wed, 12 Dec 2018 17:50:55 -0800 Subject: RFR: JDK-8215243: JShell tests failing intermitently with "Problem cleaning up the following threads:" In-Reply-To: <5C10FA7F.6080008@oracle.com> References: <5C10FA7F.6080008@oracle.com> Message-ID: <796f494e-a350-3f29-8522-2ea5bf18b891@oracle.com> That makes sense. Thumbs up. -Robert On 12/12/18 4:09 AM, Jan Lahoda wrote: > Hi, > > After the JLine upgrade, the JShell tests tend to randomly fail with > errors like: > JavaTest Message: Problem cleaning up the following threads: > Thread-74 > ? at java.base at 12-internal/java.lang.Object.wait(Native Method) > ? at java.base at 12-internal/java.lang.Object.wait(Object.java:328) > ? at > app/jdk.jshell at 12-internal/jdk.internal.jshell.tool.StopDetectingInputStream.read(StopDetectingInputStream.java:98) > ? at > app/jdk.jshell at 12-internal/jdk.internal.jshell.tool.ConsoleIOContext$TestTerminal.lambda$new$0(ConsoleIOContext.java:1212) > ? at > app/jdk.jshell at 12-internal/jdk.internal.jshell.tool.ConsoleIOContext$TestTerminal$$Lambda$245/0x0000000100236040.run(Unknown > Source) > ? at java.base at 12-internal/java.lang.Thread.run(Thread.java:835) > > Sadly, I didn't see that on my runs so far, but it seems to happen > frequently enough on the continuous builders. I was looking at the > StopDetectingInputStream and related classes for potential problems. > When the ConsoleIOContext is closed, it shutdowns the > StopDetectingInputStream, which sets its state to CLOSED, and the read > method then returns with -1. I didn't find a problem with this part. > > But, in StopDetecctingInputStream.write, there is: > if (state != State.BUFFER) { > ??? state = State.WAIT; > } > > This could potentially un-close the StopDetectingInputStream if the > write method is called on a closed instance, the instance would be > "reopened", and if things would happen in a wrong sequence/order, the > "read" method could wait indefinitely, presumably leading to the > problem with cleaning up the thread. > > My proposal is to fix this by not re-setting the state CLOSED back to > WAIT even if write is called on a closed StopDetectingInputStream. I > am not sure if it will help with the problem on builders, but appears > to be a correct thing to do anyway. > > Webrev: > http://cr.openjdk.java.net/~jlahoda/8215243/webrev.00/ > JBS: > https://bugs.openjdk.java.net/browse/JDK-8215243 > > What do you think? > > Thanks! > > Jan From robert.field at oracle.com Thu Dec 13 03:15:55 2018 From: robert.field at oracle.com (Robert Field) Date: Wed, 12 Dec 2018 19:15:55 -0800 Subject: RFR 8215099: jshell tool: /help representation of ctrl/meta characters inconsistent Message-ID: <2f167542-e334-54ec-1534-3fc4b86ee3ff@oracle.com> Please review: Fix the /help in-tool documentation -- specifically: Make the representations of keys (Shift, Ctrl, Tab, etc) self-consistent and consistent with the User's Guide. Make descriptions less cryptic. Update and correct information. Make formatting consistent. Bug: ??? https://bugs.openjdk.java.net/browse/JDK-8215099 Webrev: ?? http://cr.openjdk.java.net/~rfield/8215099v0.webrev/ Thanks, Robert From jonathan.gibbons at oracle.com Thu Dec 13 04:20:04 2018 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Wed, 12 Dec 2018 20:20:04 -0800 Subject: RFR 8215099: jshell tool: /help representation of ctrl/meta characters inconsistent In-Reply-To: <2f167542-e334-54ec-1534-3fc4b86ee3ff@oracle.com> References: <2f167542-e334-54ec-1534-3fc4b86ee3ff@oracle.com> Message-ID: <2e609c2c-80cd-1e04-b686-cb52924090eb@oracle.com> Double period? 192 jshell.console.empty = \nEmpty entry. A single valid expression or statement must proceed Shift+Tab m.. It's not wrong, but I'm curious as to the reason for the convention of the pattern of \n followed by some number of \t and then \, as compared to putting the \t at the beginning of the following line. -- Jon On 12/12/18 7:15 PM, Robert Field wrote: > Please review: > > Fix the /help in-tool documentation -- specifically: > Make the representations of keys (Shift, Ctrl, Tab, etc) > self-consistent and consistent with the User's Guide. > Make descriptions less cryptic. > Update and correct information. > Make formatting consistent. > > Bug: > > ??? https://bugs.openjdk.java.net/browse/JDK-8215099 > > Webrev: > > ?? http://cr.openjdk.java.net/~rfield/8215099v0.webrev/ > > Thanks, > Robert > > From robert.field at oracle.com Thu Dec 13 06:35:55 2018 From: robert.field at oracle.com (Robert Field) Date: Wed, 12 Dec 2018 22:35:55 -0800 Subject: RFR 8215099: jshell tool: /help representation of ctrl/meta characters inconsistent In-Reply-To: <2e609c2c-80cd-1e04-b686-cb52924090eb@oracle.com> References: <2f167542-e334-54ec-1534-3fc4b86ee3ff@oracle.com> <2e609c2c-80cd-1e04-b686-cb52924090eb@oracle.com> Message-ID: <167a64760f8.2794.4011f3a8741ca2aabce58b8b81f42d24@oracle.com> On December 12, 2018 8:20:05 PM Jonathan Gibbons wrote: > Double period? > > > 192 jshell.console.empty = \nEmpty entry. A single valid expression or > statement must proceed Shift+Tab m.. Oops. Thanks. > It's not wrong, but I'm curious as to the reason for the convention of the > pattern of \n followed by some number of \t and then \, > as compared to putting the \t at the beginning of the following line. It is a pattern inherited/recommended long ago. Idea is all the readable stuff is in front. Including ignored spacing. Thanks, Robert. > > -- Jon > > On 12/12/18 7:15 PM, Robert Field wrote: >> Please review: >> >> Fix the /help in-tool documentation -- specifically: >> Make the representations of keys (Shift, Ctrl, Tab, etc) self-consistent >> and consistent with the User's Guide. >> Make descriptions less cryptic. >> Update and correct information. >> Make formatting consistent. >> >> Bug: >> >> https://bugs.openjdk.java.net/browse/JDK-8215099 >> >> Webrev: >> >> http://cr.openjdk.java.net/~rfield/8215099v0.webrev/ >> >> Thanks, >> Robert From jan.lahoda at oracle.com Thu Dec 13 14:51:51 2018 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Thu, 13 Dec 2018 15:51:51 +0100 Subject: RFR 8215099: jshell tool: /help representation of ctrl/meta characters inconsistent In-Reply-To: <2e609c2c-80cd-1e04-b686-cb52924090eb@oracle.com> References: <2f167542-e334-54ec-1534-3fc4b86ee3ff@oracle.com> <2e609c2c-80cd-1e04-b686-cb52924090eb@oracle.com> Message-ID: <5C127207.4060206@oracle.com> Looks good to me, except for the double dot noted by Jon. Thanks for fixing the help, Robert! Jan On 13.12.2018 05:20, Jonathan Gibbons wrote: > Double period? > > 192 jshell.console.empty = \nEmpty entry. A single valid expression or > statement must proceed Shift+Tab m.. > > It's not wrong, but I'm curious as to the reason for the convention of > the pattern of \n followed by some number of \t and then \, > as compared to putting the \t at the beginning of the following line. > > -- Jon > > On 12/12/18 7:15 PM, Robert Field wrote: >> Please review: >> >> Fix the /help in-tool documentation -- specifically: >> Make the representations of keys (Shift, Ctrl, Tab, etc) >> self-consistent and consistent with the User's Guide. >> Make descriptions less cryptic. >> Update and correct information. >> Make formatting consistent. >> >> Bug: >> >> https://bugs.openjdk.java.net/browse/JDK-8215099 >> >> Webrev: >> >> http://cr.openjdk.java.net/~rfield/8215099v0.webrev/ >> >> Thanks, >> Robert >> >> From brian.goetz at oracle.com Fri Dec 14 16:40:01 2018 From: brian.goetz at oracle.com (Brian Goetz) Date: Fri, 14 Dec 2018 11:40:01 -0500 Subject: ctrl-d as input to jshell Message-ID: <8f156f26-9125-44b2-8970-99c2d76d2a6c@oracle.com> I notice when I exit jshell with ctrl-d (tip build of jdk/jdk) I get an exception trace: Exception in thread "main" jdk.internal.org.jline.reader.EndOfFileException ??????? at jdk.internal.le/jdk.internal.org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:564) ??????? at jdk.internal.le/jdk.internal.org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:404) ??????? at jdk.jshell/jdk.internal.jshell.tool.ConsoleIOContext.readLine(ConsoleIOContext.java:200) ??????? at jdk.jshell/jdk.internal.jshell.tool.JShellTool.getInput(JShellTool.java:1238) ??????? at jdk.jshell/jdk.internal.jshell.tool.JShellTool.run(JShellTool.java:1174) ??????? at jdk.jshell/jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:975) ??????? at jdk.jshell/jdk.internal.jshell.tool.JShellToolBuilder.start(JShellToolBuilder.java:254) ??????? at jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider.main(JShellToolProvider.java:120) instead of exiting silently.? (I thought I recall this working quietly before, but I could be mistaken.)? In any case, we should probably catch EOFE and just exit silently. From john.r.rose at oracle.com Fri Dec 14 17:20:48 2018 From: john.r.rose at oracle.com (John Rose) Date: Fri, 14 Dec 2018 09:20:48 -0800 Subject: RFR 8215099: jshell tool: /help representation of ctrl/meta characters inconsistent In-Reply-To: <2f167542-e334-54ec-1534-3fc4b86ee3ff@oracle.com> References: <2f167542-e334-54ec-1534-3fc4b86ee3ff@oracle.com> Message-ID: <6B7FD964-AEA0-4E9C-8CD6-75910A393CA6@oracle.com> On Dec 12, 2018, at 7:15 PM, Robert Field wrote: > > http://cr.openjdk.java.net/~rfield/8215099v0.webrev/ "proceed" is misspelling or typo for "precede" (proceed implies movement and as a verb takes no object) https://writingexplained.org/precede-vs-proceed-difference From robert.field at oracle.com Fri Dec 14 19:30:53 2018 From: robert.field at oracle.com (Robert Field) Date: Fri, 14 Dec 2018 11:30:53 -0800 Subject: ctrl-d as input to jshell In-Reply-To: <8f156f26-9125-44b2-8970-99c2d76d2a6c@oracle.com> References: <8f156f26-9125-44b2-8970-99c2d76d2a6c@oracle.com> Message-ID: <88f6857f-c281-de82-0101-7b8b6d38dfda@oracle.com> I get that too. Must be a side-effect of the switch to JLine 3. Jan, I've created: ??? https://bugs.openjdk.java.net/browse/JDK-8215438 And assigned to you. -Robert On 12/14/18 8:40 AM, Brian Goetz wrote: > I notice when I exit jshell with ctrl-d (tip build of jdk/jdk) I get > an exception trace: > > Exception in thread "main" > jdk.internal.org.jline.reader.EndOfFileException > ??????? at > jdk.internal.le/jdk.internal.org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:564) > ??????? at > jdk.internal.le/jdk.internal.org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:404) > ??????? at > jdk.jshell/jdk.internal.jshell.tool.ConsoleIOContext.readLine(ConsoleIOContext.java:200) > ??????? at > jdk.jshell/jdk.internal.jshell.tool.JShellTool.getInput(JShellTool.java:1238) > ??????? at > jdk.jshell/jdk.internal.jshell.tool.JShellTool.run(JShellTool.java:1174) > ??????? at > jdk.jshell/jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:975) > ??????? at > jdk.jshell/jdk.internal.jshell.tool.JShellToolBuilder.start(JShellToolBuilder.java:254) > ??????? at > jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider.main(JShellToolProvider.java:120) > > > instead of exiting silently.? (I thought I recall this working quietly > before, but I could be mistaken.)? In any case, we should probably > catch EOFE and just exit silently. From robert.field at oracle.com Fri Dec 14 22:10:28 2018 From: robert.field at oracle.com (Robert Field) Date: Fri, 14 Dec 2018 14:10:28 -0800 Subject: RFR 8215099: jshell tool: /help representation of ctrl/meta characters inconsistent In-Reply-To: <6B7FD964-AEA0-4E9C-8CD6-75910A393CA6@oracle.com> References: <2f167542-e334-54ec-1534-3fc4b86ee3ff@oracle.com> <6B7FD964-AEA0-4E9C-8CD6-75910A393CA6@oracle.com> Message-ID: <01a8416e-e69a-80e3-7fad-f66e861a2e5c@oracle.com> Thank to the reviews, some old issues get cleaned up. Since this is doc only, this is OK for ramp-down one, right? Thanks, Robert On 12/14/18 9:20 AM, John Rose wrote: > On Dec 12, 2018, at 7:15 PM, Robert Field > wrote: >> >> http://cr.openjdk.java.net/~rfield/8215099v0.webrev/ > > "proceed" is misspelling or typo for "precede" > (proceed implies movement and as a verb takes no object) > https://writingexplained.org/precede-vs-proceed-difference >