8215099: jshell tool: /help representation of ctrl/meta characters inconsistent
authorrfield
Sat, 15 Dec 2018 17:13:39 -0800
changeset 53058 83840e83476a
parent 53057 c7ab0761ef88
child 53059 041f1cbdae3e
8215099: jshell tool: /help representation of ctrl/meta characters inconsistent Reviewed-by: jlahoda
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties
test/langtools/jdk/jshell/ToolShiftTabTest.java
test/langtools/jdk/jshell/ToolSimpleTest.java
--- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Sat Dec 15 20:03:06 2018 +0100
+++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Sat Dec 15 17:13:39 2018 -0800
@@ -187,12 +187,12 @@
 jshell.console.resolvable = \nThe identifier is resolvable in this context.
 jshell.console.no.candidate = \nNo candidate fully qualified names found to import.
 jshell.console.incomplete = \nResults may be incomplete; try again later for complete results.
-jshell.console.erroneous = \nIncomplete or erroneous. A single valid expression or statement must proceed Shift-<tab> m.
-jshell.console.exprstmt = \nA single valid expression or statement must proceed Shift-<tab> m.
-jshell.console.empty = \nEmpty entry. A single valid expression or statement must proceed Shift-<tab> m..
+jshell.console.erroneous = \nIncomplete or erroneous. A single valid expression or statement must precede Shift+Tab m.
+jshell.console.exprstmt = \nA single valid expression or statement must precede Shift+Tab m.
+jshell.console.empty = \nEmpty entry. A single valid expression or statement must precede Shift+Tab m.
 
 jshell.fix.wrong.shortcut =\
-Unexpected character after Shift-Tab.\n\
+Unexpected character after Shift+Tab.\n\
 Use "i" for auto-import, "v" for variable creation, or "m" for method creation.\n\
 For more information see:\n\
    /help shortcuts
@@ -579,92 +579,92 @@
 This support is similar to readline/editline with simple emacs-like bindings.\n\
 There are also jshell tool specific key sequences.\n\
 \n\
---- Line and history navigation ---\n\
-\n\
-Return\n\t\
-  Enters the current snippet\n\
-Left-arrow or Ctrl+B\n\t\
-  Moves backward one character\n\
-Right-arrow or Ctrl+F\n\t\
-  Moves forward one character\n\
-Up-arrow or Ctrl+P\n\t\
-  Moves up one line, backward through history\n\
-Down arrow or Ctrl+N\n\t\
-  Moves down one line, forward through history\n\
-Ctrl+A\n\t\
-  Moves to the beginning of the line\n\
-Ctrl+E\n\t\
-  Moves to the end of the line\n\
-Meta+B\n\t\
-  Moves backward one word\n\
-Meta+F\n\t\
-  Moves forward one word\n\
-Ctrl+R\n\t\
+Line and history navigation:\n\
+\n\t\
+Return\n\t\t\
+  Enters the current snippet\n\t\
+Left-arrow or Ctrl+B\n\t\t\
+  Moves backward one character\n\t\
+Right-arrow or Ctrl+F\n\t\t\
+  Moves forward one character\n\t\
+Up-arrow or Ctrl+P\n\t\t\
+  Moves up one line, backward through history\n\t\
+Down arrow or Ctrl+N\n\t\t\
+  Moves down one line, forward through history\n\t\
+Ctrl+A\n\t\t\
+  Moves to the beginning of the line\n\t\
+Ctrl+E\n\t\t\
+  Moves to the end of the line\n\t\
+Meta+B\n\t\t\
+  Moves backward one word\n\t\
+Meta+F\n\t\t\
+  Moves forward one word\n\t\
+Ctrl+R\n\t\t\
   Search backward through history\n\
 \n\
 \n\
---- Line and history basic editing ---\n\
-\n\
-Meta+Return or Ctrl+Return (depending on platform)\n\t\
-  Insert a new line in snippet\n\
-Ctrl+_ (underscore may require shift key) or Ctrl+X then Ctrl+U\n\t\
-  Undo edit - repeat to undo more edits\n\
-Delete\n\t\
-  Deletes the character at or after the cursor, depending on the operating system\n\
-Backspace\n\t\
-  Deletes the character before the cursor\n\
-Ctrl+K\n\t\
-  Deletes the text from the cursor to the end of the line\n\
-Meta+D\n\t\
-  Deletes the text from the cursor to the end of the word\n\
-Ctrl+W\n\t\
-  Deletes the text from the cursor to the previous white space\n\
-Ctrl+Y\n\t\
-  Pastes the most recently deleted text into the line\n\
-Meta+Y\n\t\
-  After Ctrl+Y, Meta+Y cycles through previously deleted text\n\
-Ctrl+X then Ctrl+K\n\t\
+Line and history basic editing:\n\
+\n\t\
+Meta+Return or Ctrl+Return (depending on platform)\n\t\t\
+  Insert a new line in snippet\n\t\
+Ctrl+_ (underscore may require the Shift key) or Ctrl+X then Ctrl+U\n\t\t\
+  Undo edit - repeat to undo more edits\n\t\
+Delete\n\t\t\
+  Deletes the character at or after the cursor, depending on the operating system\n\t\
+Backspace\n\t\t\
+  Deletes the character before the cursor\n\t\
+Ctrl+K\n\t\t\
+  Deletes the text from the cursor to the end of the line\n\t\
+Meta+D\n\t\t\
+  Deletes the text from the cursor to the end of the word\n\t\
+Ctrl+W\n\t\t\
+  Deletes the text from the cursor to the previous white space\n\t\
+Ctrl+Y\n\t\t\
+  Pastes the most recently deleted text into the line\n\t\
+Meta+Y\n\t\t\
+  After Ctrl+Y, Meta+Y cycles through previously deleted text\n\t\
+Ctrl+X then Ctrl+K\n\t\t\
   Delete whole snippet\n\
 \n\
 \n\
---- Shortcuts for jshell tool ---\n\
-\n\
+Shortcuts for jshell tool:\n\
+\n\t\
 For details, see: /help shortcuts\n\
-\n\
-Tab\n\t\
-  Complete Java identifier or jshell command\n\
-Shift+Tab then v\n\t\
-  Convert expression to variable declaration\n\
-Shift+Tab then m\n\t\
-  Convert statement to method declaration\n\
-Shift+Tab then i\n\t\
-  Add imports for this identifier\n\
+\n\t\
+Tab\n\t\t\
+  Complete Java identifier or jshell command\n\t\
+Shift+Tab then v\n\t\t\
+  Convert expression to variable declaration\n\t\
+Shift+Tab then m\n\t\t\
+  Convert statement to method declaration\n\t\
+Shift+Tab then i\n\t\t\
+  Add imports for this identifier\n\t\
 \n\
 \n\
---- More line and history editing ---\n\
-\n\
-Ctrl+L\n\t\
-  Clear screen and reprint snippet\n\
-Ctrl+U\n\t\
-  Kill whole line\n\
-Ctrl+T\n\t\
-  Transpose characters\n\
-Ctrl+X then Ctrl+B\n\t\
-  Navigate to matching bracket, parenthesis, ...\n\
-Ctrl+X then =\n\t\
-  Enter show current character position mode\n\
-Ctrl+X then Ctrl+O\n\t\
-  Toggle overwrite characters vs insert characters\n\
-Meta+C\n\t\
-  Capitalize word\n\
-Meta+U\n\t\
-  Convert word to uppercase\n\
-Meta+L\n\t\
-  Convert word to lowercase\n\
-Meta+0 through Meta+9 then key\n\t\
+More line and history editing:\n\
+\n\t\
+Ctrl+L\n\t\t\
+  Clear screen and reprint snippet\n\t\
+Ctrl+U\n\t\t\
+  Kill whole line\n\t\
+Ctrl+T\n\t\t\
+  Transpose characters\n\t\
+Ctrl+X then Ctrl+B\n\t\t\
+  Navigate to matching bracket, parenthesis, ...\n\t\
+Ctrl+X then =\n\t\t\
+  Enter show current character position mode\n\t\
+Ctrl+X then Ctrl+O\n\t\t\
+  Toggle overwrite characters vs insert characters\n\t\
+Meta+C\n\t\t\
+  Capitalize word\n\t\
+Meta+U\n\t\t\
+  Convert word to uppercase\n\t\
+Meta+L\n\t\t\
+  Convert word to lowercase\n\t\
+Meta+0 through Meta+9 then key\n\t\t\
   Repeat the specified number of times\n\
 \n\
-Where, for example, "Ctrl+A" means hold down the control key and press A.\n\
+Where, for example, "Ctrl+A" means hold down the Control key and press A.\n\
 Where "Meta" is "Alt" on many keyboards.\n\
 Line editing support is derived from JLine 3.
 
@@ -672,26 +672,34 @@
 information access, and automatic code generation
 help.shortcuts =\
 Supported shortcuts include:\n\
-\n\
-<tab>\n\t\t\
+\n\t\
+Tab\n\t\t\
         After entering the first few letters of a Java identifier,\n\t\t\
-        a jshell tool command, or, in some cases, a jshell tool command argument,\n\t\t\
-        press the <tab> key to complete the input.\n\t\t\
-        If there is more than one completion, then possible completions will be shown.\n\t\t\
-        Will show documentation if available and appropriate.\n\n\
-Shift-<tab> v\n\t\t\
-        After a complete expression, hold down <shift> while pressing <tab>,\n\t\t\
-        then release and press "v", the expression will be converted to\n\t\t\
-        a variable declaration whose type is based on the type of the expression.\n\n\
-Shift-<tab> m\n\t\t\
-        After a complete expression or statement, hold down <shift> while pressing <tab>,\n\t\t\
-        then release and press "m", the expression or statement will be converted to\n\t\t\
-        a method declaration. If an expression, the return type is based on the type\n\t\t\
-        of the expression.\n\n\
-Shift-<tab> i\n\t\t\
-        After an unresolvable identifier, hold down <shift> while pressing <tab>,\n\t\t\
-        then release and press "i", and the jshell tool will propose possible imports\n\t\t\
-        which will resolve the identifier based on the content of the specified classpath.
+        a jshell tool command, or, in some cases, a jshell tool\n\t\t\
+        command argument, press the Tab key to complete the input.\n\t\t\
+        If there is more than one completion, then possible completions\n\t\t\
+        will be shown.\n\t\t\
+        Another Tab will show documentation if available and appropriate.\n\n\t\
+Shift+Tab then v\n\t\t\
+        After a complete expression, hold down the Shift key while\n\t\t\
+        pressing the Tab key, then release and press the "v" key,\n\t\t\
+        the expression will be converted to a variable declaration \n\t\t\
+        whose type is based on the type of the expression.\n\n\t\
+Shift+Tab then m\n\t\t\
+        After a complete expression or statement, hold down the\n\t\t\
+        Shift key while pressing the Tab key, then release and press\n\t\t\
+        the "m" key, the expression or statement will be converted\n\t\t\
+        to a method declaration. If it is an expression, the method\n\t\t\
+        return type will be based on the type of the expression.\n\n\t\
+Shift+Tab then i\n\t\t\
+        After an unresolvable identifier, hold down the Shift key\n\t\t\
+        while pressing the Tab key, then release and press the "i" key,\n\t\t\
+        and the jshell tool will propose possible imports which will\n\t\t\
+        resolve the identifier based on the content of the specified\n\t\t\
+        classpath. Enter the digit corresponding to the desired import,\n\t\t\
+        or press the "0" key to add no imports.\n\
+\n\
+For information onother special keys see: /help keys
 
 help.context.summary = a description of the evaluation context options for /env /reload and /reset
 help.context =\
@@ -789,7 +797,7 @@
 Any number of IDs or ID ranges may be used, e.g.:  /3-7 s4 14-16 e2\n\
 See also '/help id'.\n\
 \n\
-Finally, you can search backwards through history by entering ctrl-R followed by the string to search for.
+Finally, you can search backwards through history by entering Ctrl+R followed by the string to search for.
 
 help.set._retain = \
 The '-retain' option saves a setting so that it is used in future sessions.\n\
--- a/test/langtools/jdk/jshell/ToolShiftTabTest.java	Sat Dec 15 20:03:06 2018 +0100
+++ b/test/langtools/jdk/jshell/ToolShiftTabTest.java	Sat Dec 15 17:13:39 2018 -0800
@@ -126,7 +126,7 @@
         doRunTest((inputSink, out) -> {
             inputSink.write("123");
             inputSink.write(FIX + "z");
-            waitOutput(out, "Unexpected character after Shift-Tab");
+            waitOutput(out, "Unexpected character after Shift\\+Tab");
         });
     }
 }
--- a/test/langtools/jdk/jshell/ToolSimpleTest.java	Sat Dec 15 20:03:06 2018 +0100
+++ b/test/langtools/jdk/jshell/ToolSimpleTest.java	Sat Dec 15 17:13:39 2018 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103  8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508 8177466 8172154 8192979 8191842 8198573 8198801 8210596 8210959
+ * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103  8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508 8177466 8172154 8192979 8191842 8198573 8198801 8210596 8210959 8215099
  * @summary Simple jshell tool tests
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -448,7 +448,8 @@
         test(
                 (a) -> assertHelp(a, "/?", "/list", "/help", "/exit", "intro"),
                 (a) -> assertHelp(a, "/help", "/list", "/help", "/exit", "intro"),
-                (a) -> assertHelp(a, "/help short", "shortcuts", "<tab>"),
+                (a) -> assertHelp(a, "/help short", "shortcuts", "Tab"),
+                (a) -> assertHelp(a, "/help keys", "line", "Shift", "imports", "history"),
                 (a) -> assertHelp(a, "/? /li", "/list -all", "snippets"),
                 (a) -> assertHelp(a, "/help /set prompt", "optionally contain '%s'", "quoted"),
                 (a) -> assertHelp(a, "/help /help", "/help <command>"),