changeset 45501:a13e5e2ee35e

8180306: jshell tool: /help -- confusing identifier in feedback mode examples 8179048: jshell tool: /help -- references to "/reset or /reload" should add /env 8179046: jshell tool: /help /edit is missing -all and -start 8181950: jshell tests: longer help documentation breaks tests because of paging Reviewed-by: jlahoda
author rfield
date Tue, 13 Jun 2017 12:31:28 -0700
parents 365640343c55
children d23ae2d67a5d
files langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties langtools/test/jdk/jshell/MergedTabShiftTabCommandTest.java
diffstat 3 files changed, 38 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java	Tue Jun 13 11:21:09 2017 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java	Tue Jun 13 12:31:28 2017 -0700
@@ -43,7 +43,6 @@
 import java.util.Locale;
 import java.util.Map;
 import java.util.Optional;
-import java.util.function.BooleanSupplier;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -962,6 +961,7 @@
             this.input = input;
         }
 
+        @Override
         public boolean isRaw() {
             try {
                 return getSettings().get("-a").contains("-icanon");
@@ -1053,12 +1053,23 @@
     private static final class TestTerminal extends TerminalSupport {
 
         private final StopDetectingInputStream input;
+        private final int height;
 
         public TestTerminal(StopDetectingInputStream input) throws Exception {
             super(true);
             setAnsiSupported(false);
             setEchoEnabled(false);
             this.input = input;
+            int h = DEFAULT_HEIGHT;
+            try {
+                String hp = System.getProperty("test.terminal.height");
+                if (hp != null && !hp.isEmpty()) {
+                    h = Integer.parseInt(hp);
+                }
+            } catch (Throwable ex) {
+                // ignore
+            }
+            this.height = h;
         }
 
         @Override
@@ -1066,6 +1077,11 @@
             return input.setInputStream(super.wrapInIfNeeded(in));
         }
 
+        @Override
+        public int getHeight() {
+            return height;
+        }
+
     }
 
     private interface SuspendableTerminal {
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Tue Jun 13 11:21:09 2017 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Tue Jun 13 12:31:28 2017 -0700
@@ -249,6 +249,11 @@
     Edit the snippets with the specified snippet ids\n\n\
 /edit <id>-<id>\n\t\
     Edit the snippets within the range of snippet ids\n\n\
+/edit -start\n\t\
+    Edit the automatically evaluated start-up snippets. Any changes are in this\n\t\
+    session, and do not affect the start-up setting\n\n\
+/edit -all\n\t\
+    Edit all snippets including failed, overwritten, dropped, and start-up\n\n\
 /edit\n\t\
     Edit the currently active snippets of code that you typed or read with /open
 
@@ -393,7 +398,7 @@
      recent.\n\n\
 /reload -restore\n\t\
      Reset and replay the valid history between the previous and most\n\t\
-     recent time that jshell was entered, or a /reset, or /reload\n\t\
+     recent time that jshell was entered, or a /reset, /reload, or /env\n\t\
      command was executed. This can thus be used to restore a previous\n\t\
      jshell tool session.\n\n\
 /reload [-restore] -quiet\n\t\
@@ -695,18 +700,18 @@
    error1 -- one error\n\t\
    error2 -- two or more errors\n\n\
 Examples:\n\t\
-/set format myformat action 'Created' added-primary\n\t\
-/set format myformat action 'Update replaced' replaced-update\n\t\
-/set format myformat display '{pre}{action} class {name}{post}' class-ok\n\t\
-/set format myformat display '{pre}{action} variable {name}, reset to null{post}' replaced-vardecl,varinit-ok-update\n\n\
+/set format mymode action 'Created' added-primary\n\t\
+/set format mymode action 'Update replaced' replaced-update\n\t\
+/set format mymode display '{pre}{action} class {name}{post}' class-ok\n\t\
+/set format mymode display '{pre}{action} variable {name}, reset to null{post}' replaced-vardecl,varinit-ok-update\n\n\
 Note that subsequent selectors for a field may overwrite some or all of previous used selectors -- last one wins\n\
 \n\
 The form without <format> shows the current format settings.\n\
 When the <mode> is specified only the format settings for that mode are shown.\n\
 When both the <mode> and <field> are specified only the format settings for that\n\
 mode and field are shown.  Example:\n\t\
-/set format myformat\n\
-shows the format settings for the mode myformat\n
+/set format mymode\n\
+shows the format settings for the mode mymode\n
 
 help.set.truncation = \
 Set the max length of a displayed value:\n\
@@ -745,8 +750,8 @@
 The form without <length> shows the truncation settings.\n\
 When the <mode> is specified only the truncation settings for that mode are shown.\n\
 Example:\n\t\
-/set truncation myformat\n\
-shows the truncation settings for the mode myformat\n
+/set truncation mymode\n\
+shows the truncation settings for the mode mymode\n
 
 help.set.feedback = \
 Set the feedback mode describing displayed feedback for entered snippets and commands:\n\
@@ -818,9 +823,9 @@
 Note: the settings for the mode include the settings for prompt, format, and\n\
 truncation.\n\
 Example:\n\t\
-/set mode myformat\n\
+/set mode mymode\n\
 \n\
-shows the mode, prompt, format, and truncation settings for the mode myformat
+shows the mode, prompt, format, and truncation settings for the mode mymode
 
 help.set.prompt = \
 Set the prompts.  Both the normal prompt and the continuation-prompt must be set:\n\
@@ -840,8 +845,8 @@
 The form without <prompt> shows the currently set prompts.\n\
 When the <mode> is specified only the prompts for that mode are shown.\n\
 Example:\n\t\
-/set prompt myformat\n\
-shows the prompts set for the mode myformat\n
+/set prompt mymode\n\
+shows the prompts set for the mode mymode\n
 
 help.set.editor =\
 Specify the command to launch for the /edit command:\n\
--- a/langtools/test/jdk/jshell/MergedTabShiftTabCommandTest.java	Tue Jun 13 11:21:09 2017 -0700
+++ b/langtools/test/jdk/jshell/MergedTabShiftTabCommandTest.java	Tue Jun 13 12:31:28 2017 -0700
@@ -44,6 +44,9 @@
 public class MergedTabShiftTabCommandTest extends UITesting {
 
     public void testCommand() throws Exception {
+        // set terminal height so that help output won't hit page breaks
+        System.setProperty("test.terminal.height", "1000000");
+
         doRunTest((inputSink, out) -> {
             inputSink.write("1\n");
             waitOutput(out, "\u0005");