langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java
equal
deleted
inserted
replaced
60 import jdk.internal.jline.console.completer.Completer; |
60 import jdk.internal.jline.console.completer.Completer; |
61 import jdk.internal.jline.console.history.History; |
61 import jdk.internal.jline.console.history.History; |
62 import jdk.internal.jline.console.history.MemoryHistory; |
62 import jdk.internal.jline.console.history.MemoryHistory; |
63 import jdk.internal.jline.extra.EditingHistory; |
63 import jdk.internal.jline.extra.EditingHistory; |
64 import jdk.internal.jshell.tool.StopDetectingInputStream.State; |
64 import jdk.internal.jshell.tool.StopDetectingInputStream.State; |
|
65 import jdk.internal.misc.Signal; |
|
66 import jdk.internal.misc.Signal.Handler; |
65 |
67 |
66 class ConsoleIOContext extends IOContext { |
68 class ConsoleIOContext extends IOContext { |
67 |
69 |
68 private static final String HISTORY_LINE_PREFIX = "HISTORY_LINE_"; |
70 private static final String HISTORY_LINE_PREFIX = "HISTORY_LINE_"; |
69 |
71 |
168 bind(DOCUMENTATION_SHORTCUT, (ActionListener) evt -> documentation(repl)); |
170 bind(DOCUMENTATION_SHORTCUT, (ActionListener) evt -> documentation(repl)); |
169 for (FixComputer computer : FIX_COMPUTERS) { |
171 for (FixComputer computer : FIX_COMPUTERS) { |
170 for (String shortcuts : SHORTCUT_FIXES) { |
172 for (String shortcuts : SHORTCUT_FIXES) { |
171 bind(shortcuts + computer.shortcut, (ActionListener) evt -> fixes(computer)); |
173 bind(shortcuts + computer.shortcut, (ActionListener) evt -> fixes(computer)); |
172 } |
174 } |
|
175 } |
|
176 try { |
|
177 Signal.handle(new Signal("CONT"), new Handler() { |
|
178 @Override public void handle(Signal sig) { |
|
179 try { |
|
180 in.getTerminal().reset(); |
|
181 in.redrawLine(); |
|
182 in.flush(); |
|
183 } catch (Exception ex) { |
|
184 ex.printStackTrace(); |
|
185 } |
|
186 } |
|
187 }); |
|
188 } catch (IllegalArgumentException ignored) { |
|
189 //the CONT signal does not exist on this platform |
173 } |
190 } |
174 } |
191 } |
175 |
192 |
176 @Override |
193 @Override |
177 public String readLine(String prompt, String prefix) throws IOException, InputInterruptedException { |
194 public String readLine(String prompt, String prefix) throws IOException, InputInterruptedException { |