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
This commit is contained in:
Robert Field 2017-06-13 12:31:28 -07:00
parent bfe58ed881
commit efb4e963d6
3 changed files with 38 additions and 14 deletions

View File

@ -43,7 +43,6 @@ import java.util.List;
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 @@ class ConsoleIOContext extends IOContext {
this.input = input;
}
@Override
public boolean isRaw() {
try {
return getSettings().get("-a").contains("-icanon");
@ -1053,12 +1053,23 @@ class ConsoleIOContext extends IOContext {
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 @@ class ConsoleIOContext extends IOContext {
return input.setInputStream(super.wrapInIfNeeded(in));
}
@Override
public int getHeight() {
return height;
}
}
private interface SuspendableTerminal {

View File

@ -249,6 +249,11 @@ If no editor has been set, a simple editor will be launched.\n\
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 @@ and any /drop commands in the order they were entered.\n\
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 @@ The errors-count selector kind describes the number of errors. The values are:\
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 @@ Note that subsequent selectors for a field may overwrite some or all of previous
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 @@ When the <mode> is specified, only the mode settings for that mode are shown.\n\
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 continuation-prompt is used on the second and subsequent lines of a multi-li
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\

View File

@ -44,6 +44,9 @@ import org.testng.annotations.Test;
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");