1.1 --- a/jshell.support/src/org/netbeans/modules/jshell/support/ShellSession.java Tue Oct 17 16:34:17 2017 +0200
1.2 +++ b/jshell.support/src/org/netbeans/modules/jshell/support/ShellSession.java Tue Oct 17 16:38:27 2017 +0200
1.3 @@ -637,6 +637,10 @@
1.4 execEnv);
1.5 }
1.6
1.7 + protected List<String> historyItems() {
1.8 + return ShellSession.this.historyItems().stream().map((i) -> i.getContents()).collect(Collectors.toList());
1.9 + }
1.10 +
1.11 @Override
1.12 protected JShell.Builder makeBuilder() {
1.13 return customizeBuilder(super.makeBuilder());
1.14 @@ -716,6 +720,8 @@
1.15 }
1.16 return super.execControlCreated(ctrl);
1.17 }
1.18 +
1.19 +
1.20 }
1.21
1.22 private SwitchingJavaFileManger fileman;
1.23 @@ -1614,11 +1620,12 @@
1.24 public void run(ResultIterator resultIterator) throws Exception {
1.25 ConsoleContents console = ConsoleContents.get(resultIterator);
1.26 ConsoleSection input = console.getInputSection();
1.27 + ConsoleSection exec = console.getSectionModel().getExecutingSection();
1.28 for (ConsoleSection s : console.getSectionModel().getSections()) {
1.29 if (!s.getType().input) {
1.30 continue;
1.31 }
1.32 - if (s == input) {
1.33 + if (s == input || s == exec) {
1.34 // do not save current input
1.35 continue;
1.36 }
2.1 --- a/jshell.support/src/org/netbeans/modules/jshell/tool/JShellLauncher.java Tue Oct 17 16:34:17 2017 +0200
2.2 +++ b/jshell.support/src/org/netbeans/modules/jshell/tool/JShellLauncher.java Tue Oct 17 16:38:27 2017 +0200
2.3 @@ -46,6 +46,7 @@
2.4 import java.io.PrintStream;
2.5 import java.io.ByteArrayInputStream;
2.6 import java.util.Collections;
2.7 +import java.util.List;
2.8 import java.util.Locale;
2.9 import java.util.Map;
2.10 import java.util.prefs.Preferences;
2.11 @@ -138,6 +139,10 @@
2.12 }
2.13 }
2.14
2.15 + protected List<String> historyItems() {
2.16 + return Collections.emptyList();
2.17 + }
2.18 +
2.19 private class IOContextImpl extends IOContext {
2.20 private String str;
2.21 private String promptAfter;
2.22 @@ -169,7 +174,7 @@
2.23
2.24 @Override
2.25 public Iterable<String> currentSessionHistory() {
2.26 - return Collections.emptyList();
2.27 + return historyItems();
2.28 }
2.29
2.30 @Override
3.1 --- a/jshell.support/src/org/netbeans/modules/jshell/tool/JShellTool.java Tue Oct 17 16:34:17 2017 +0200
3.2 +++ b/jshell.support/src/org/netbeans/modules/jshell/tool/JShellTool.java Tue Oct 17 16:38:27 2017 +0200
3.3 @@ -808,13 +808,17 @@
3.4 private boolean isRunningInteractive() {
3.5 return currentNameSpace != null && currentNameSpace == mainNamespace;
3.6 }
3.7 +
3.8 + boolean permitSystemSettings = false;
3.9
3.10 //where -- one-time per run initialization of feedback modes
3.11 private void initFeedback() {
3.12 // No fluff, no prefix, for init failures
3.13 MessageHandler initmh = new InitMessageHandler();
3.14 // Execute the feedback initialization code in the resource file
3.15 + permitSystemSettings = true;
3.16 startUpRun(getResourceString("startup.feedback"));
3.17 + permitSystemSettings = false;
3.18 // These predefined modes are read-only
3.19 feedback.markModesReadOnly();
3.20 // Restore user defined modes retained on previous run with /set mode -retain
3.21 @@ -1315,11 +1319,11 @@
3.22 "mode", skipWordThenCompletion(orMostSpecificCompletion(
3.23 feedback.modeCompletions(SET_MODE_OPTIONS_COMPLETION_PROVIDER),
3.24 SET_MODE_OPTIONS_COMPLETION_PROVIDER)),
3.25 - "prompt", feedback.modeCompletions(),
3.26 - "editor", fileCompletions(Files::isExecutable),
3.27 +// "prompt", feedback.modeCompletions(),
3.28 +// "editor", fileCompletions(Files::isExecutable),
3.29 "start", FILE_COMPLETION_PROVIDER),
3.30 STARTSWITH_MATCHER),
3.31 - CommandKind.HIDDEN));
3.32 + CommandKind.NORMAL));
3.33
3.34 registerCommand(new Command("/?",
3.35 "help.quest",
3.36 @@ -1412,15 +1416,17 @@
3.37 return feedback.setMode(this, at,
3.38 retained -> prefs.put(MODE_KEY, retained));
3.39 case "prompt":
3.40 - return feedback.setPrompt(this, at);
3.41 - case "editor":
3.42 - return new SetEditor(at).set();
3.43 + if (permitSystemSettings) {
3.44 + return feedback.setPrompt(this, at);
3.45 + } else {
3.46 + break;
3.47 + }
3.48 case "start":
3.49 return setStart(at);
3.50 default:
3.51 - errormsg("jshell.err.arg", cmd, at.val());
3.52 - return false;
3.53 }
3.54 + errormsg("jshell.err.arg", cmd, at.val());
3.55 + return false;
3.56 }
3.57
3.58 boolean setFeedback(MessageHandler messageHandler, ArgTokenizer at) {