@Override public synchronized void flush() { try { if (jline) { reader.print(ConsoleReader.RESET_LINE + ""); reader.flush(); super.flush(); try { reader.drawLine(); } catch (Throwable ex) { reader.getCursorBuffer().clear(); } reader.flush(); } else { super.flush(); } } catch (IOException ex) { logger.log(Level.SEVERE, "I/O exception flushing console output", ex); } } }
private void abort() throws IOException { beep(); buf.clear(); println(); redrawLine(); }
Log.error("Could not expand event", e); beep(); buf.clear(); str = "";
/** * Possible states in which the current readline operation may be in. */ private static enum State { /** * The user is just typing away */ NORMAL, /** * In the middle of a emacs seach */ SEARCH, FORWARD_SEARCH, /** * VI "yank-to" operation ("y" during move mode) */ VI_YANK_TO, /** * VI "delete-to" operation ("d" during move mode) */ VI_DELETE_TO, /** * VI "change-to" operation ("c" during move mode) */ VI_CHANGE_TO }
public void clear() { consoleReader.getCursorBuffer().clear(); }
private void abort() throws IOException { beep(); buf.clear(); println(); redrawLine(); }
reader.drawLine(); } catch (Throwable ex) { reader.getCursorBuffer().clear();
Log.error("Could not expand event", e); beep(); buf.clear(); str = "";
@Override public void actionPerformed(ActionEvent e) { CursorBuffer buf = textTerminal.reader.getCursorBuffer(); String partialInput = buf.buffer.toString(); buf.clear(); ReadHandlerData handlerData = handler.apply(textTerminal); ReadInterruptionStrategy.Action action = handlerData.getAction(); if(action == CONTINUE) { buf.write(partialInput); } else { if(action == RESTART) { textTerminal.initialReadBuffer = partialInput; } ReadInterruptionData interruptData = ReadInterruptionData.from(handlerData, partialInput); throw new ReadInterruptionException(interruptData, partialInput); } } }
private boolean interruptTask() throws Exception { boolean interrupt = false; reader.getCursorBuffer().clear(); reader.redrawLine(); ConsoleTask task = getCurrentTask(); if (task != null) { synchronized (task) { log.debug("Interrupting task"); interrupt = true; if (task.isStopping()) { task.abort(); } else if (task.isRunning()) { task.stop(); } } } else { log.debug("No task running to interrupt"); } return interrupt; } }
/** * Possible states in which the current readline operation may be in. */ private static enum State { /** * The user is just typing away */ NORMAL, /** * In the middle of a emacs seach */ SEARCH, FORWARD_SEARCH, /** * VI "yank-to" operation ("y" during move mode) */ VI_YANK_TO, /** * VI "delete-to" operation ("d" during move mode) */ VI_DELETE_TO, /** * VI "change-to" operation ("c" during move mode) */ VI_CHANGE_TO }
reader.getCursorBuffer().clear();