langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java
equal
deleted
inserted
replaced
41 import java.util.Iterator; |
41 import java.util.Iterator; |
42 import java.util.List; |
42 import java.util.List; |
43 import java.util.Locale; |
43 import java.util.Locale; |
44 import java.util.Map; |
44 import java.util.Map; |
45 import java.util.Optional; |
45 import java.util.Optional; |
46 import java.util.function.BooleanSupplier; |
|
47 import java.util.function.Function; |
46 import java.util.function.Function; |
48 import java.util.stream.Collectors; |
47 import java.util.stream.Collectors; |
49 import java.util.stream.Stream; |
48 import java.util.stream.Stream; |
50 |
49 |
51 import jdk.internal.shellsupport.doc.JavadocFormatter; |
50 import jdk.internal.shellsupport.doc.JavadocFormatter; |
960 |
959 |
961 public JShellUnixTerminal(StopDetectingInputStream input) throws Exception { |
960 public JShellUnixTerminal(StopDetectingInputStream input) throws Exception { |
962 this.input = input; |
961 this.input = input; |
963 } |
962 } |
964 |
963 |
|
964 @Override |
965 public boolean isRaw() { |
965 public boolean isRaw() { |
966 try { |
966 try { |
967 return getSettings().get("-a").contains("-icanon"); |
967 return getSettings().get("-a").contains("-icanon"); |
968 } catch (IOException | InterruptedException ex) { |
968 } catch (IOException | InterruptedException ex) { |
969 return false; |
969 return false; |
1051 } |
1051 } |
1052 |
1052 |
1053 private static final class TestTerminal extends TerminalSupport { |
1053 private static final class TestTerminal extends TerminalSupport { |
1054 |
1054 |
1055 private final StopDetectingInputStream input; |
1055 private final StopDetectingInputStream input; |
|
1056 private final int height; |
1056 |
1057 |
1057 public TestTerminal(StopDetectingInputStream input) throws Exception { |
1058 public TestTerminal(StopDetectingInputStream input) throws Exception { |
1058 super(true); |
1059 super(true); |
1059 setAnsiSupported(false); |
1060 setAnsiSupported(false); |
1060 setEchoEnabled(false); |
1061 setEchoEnabled(false); |
1061 this.input = input; |
1062 this.input = input; |
|
1063 int h = DEFAULT_HEIGHT; |
|
1064 try { |
|
1065 String hp = System.getProperty("test.terminal.height"); |
|
1066 if (hp != null && !hp.isEmpty()) { |
|
1067 h = Integer.parseInt(hp); |
|
1068 } |
|
1069 } catch (Throwable ex) { |
|
1070 // ignore |
|
1071 } |
|
1072 this.height = h; |
1062 } |
1073 } |
1063 |
1074 |
1064 @Override |
1075 @Override |
1065 public InputStream wrapInIfNeeded(InputStream in) throws IOException { |
1076 public InputStream wrapInIfNeeded(InputStream in) throws IOException { |
1066 return input.setInputStream(super.wrapInIfNeeded(in)); |
1077 return input.setInputStream(super.wrapInIfNeeded(in)); |
|
1078 } |
|
1079 |
|
1080 @Override |
|
1081 public int getHeight() { |
|
1082 return height; |
1067 } |
1083 } |
1068 |
1084 |
1069 } |
1085 } |
1070 |
1086 |
1071 private interface SuspendableTerminal { |
1087 private interface SuspendableTerminal { |